Linux ubuntu 6.8.0-90-generic #91-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 18 14:14:30 UTC 2025 x86_64
nginx/1.24.0
: 67.217.245.49 | : 216.73.216.50
Cant Read [ /etc/named.conf ]
8.3.6
www-data
Bypass.pw
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
Backdoor Scanner
Backdoor Create
Alfa Webshell
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
usr /
sbin /
[ HOME SHELL ]
Name
Size
Permission
Action
ModemManager
2.07
MB
-rwxr-xr-x
a2disconf
15.75
KB
-rwxr-xr-x
a2dismod
15.75
KB
-rwxr-xr-x
a2dissite
15.75
KB
-rwxr-xr-x
a2enconf
15.75
KB
-rwxr-xr-x
a2enmod
15.75
KB
-rwxr-xr-x
a2ensite
15.75
KB
-rwxr-xr-x
a2query
9.6
KB
-rwxr-xr-x
aa-load
38.75
KB
-rwxr-xr-x
aa-remove-unknown
3.15
KB
-rwxr-xr-x
aa-status
39.06
KB
-rwxr-xr-x
aa-teardown
137
B
-rwxr-xr-x
accessdb
14.55
KB
-rwxr-xr-x
add-shell
1.03
KB
-rwxr-xr-x
addgnupghome
3
KB
-rwxr-xr-x
addgroup
53.9
KB
-rwxr-xr-x
adduser
53.9
KB
-rwxr-xr-x
agetty
59.56
KB
-rwxr-xr-x
apache2
736.55
KB
-rwxr-xr-x
apache2ctl
7.26
KB
-rwxr-xr-x
apachectl
7.26
KB
-rwxr-xr-x
apparmor_parser
1.55
MB
-rwxr-xr-x
apparmor_status
39.06
KB
-rwxr-xr-x
applygnupgdefaults
2.17
KB
-rwxr-xr-x
argdist-bpfcc
36
KB
-rwxr-xr-x
arp
61.61
KB
-rwxr-xr-x
arpd
26.33
KB
-rwxr-xr-x
arptables
219.16
KB
-rwxr-xr-x
arptables-nft
219.16
KB
-rwxr-xr-x
arptables-nft-restore
219.16
KB
-rwxr-xr-x
arptables-nft-save
219.16
KB
-rwxr-xr-x
arptables-restore
219.16
KB
-rwxr-xr-x
arptables-save
219.16
KB
-rwxr-xr-x
audisp-af_unix
14.31
KB
-rwxr-xr-x
audisp-remote
50.41
KB
-rwxr-xr-x
audisp-syslog
18.3
KB
-rwxr-xr-x
audispd-zos-remote
34.38
KB
-rwxr-xr-x
auditctl
50.5
KB
-rwxr-xr-x
auditd
118.41
KB
-rwxr-xr-x
augenrules
3.74
KB
-rwxr-xr-x
aureport
110.41
KB
-rwxr-xr-x
ausearch
110.45
KB
-rwxr-xr-x
autrace
18.3
KB
-rwxr-xr-x
badblocks
34.32
KB
-rwxr-xr-x
bashreadline-bpfcc
2.32
KB
-rwxr-xr-x
bashreadline.bt
698
B
-rwxr-xr-x
bcache-super-show
14.3
KB
-rwxr-xr-x
bindsnoop-bpfcc
15.96
KB
-rwxr-xr-x
biolatency-bpfcc
11.1
KB
-rwxr-xr-x
biolatency-kp.bt
664
B
-rwxr-xr-x
biolatency.bt
681
B
-rwxr-xr-x
biolatpcts-bpfcc
10.01
KB
-rwxr-xr-x
biopattern-bpfcc
3.86
KB
-rwxr-xr-x
biosdecode
27.2
KB
-rwxr-xr-x
biosnoop-bpfcc
10.58
KB
-rwxr-xr-x
biosnoop.bt
1.12
KB
-rwxr-xr-x
biostacks.bt
915
B
-rwxr-xr-x
biotop-bpfcc
9.34
KB
-rwxr-xr-x
bitesize-bpfcc
1.14
KB
-rwxr-xr-x
bitesize.bt
567
B
-rwxr-xr-x
blkdeactivate
15.97
KB
-rwxr-xr-x
blkdiscard
22.38
KB
-rwxr-xr-x
blkid
54.41
KB
-rwxr-xr-x
blkzone
34.38
KB
-rwxr-xr-x
blockdev
34.38
KB
-rwxr-xr-x
bpflist-bpfcc
2.54
KB
-rwxr-xr-x
bpftool
1.58
KB
-rwxr-xr-x
bridge
108.49
KB
-rwxr-xr-x
btrfsdist-bpfcc
6.47
KB
-rwxr-xr-x
btrfsslower-bpfcc
9.75
KB
-rwxr-xr-x
cache_check
1.36
MB
-rwxr-xr-x
cache_dump
1.36
MB
-rwxr-xr-x
cache_metadata_size
1.36
MB
-rwxr-xr-x
cache_repair
1.36
MB
-rwxr-xr-x
cache_restore
1.36
MB
-rwxr-xr-x
cache_writeback
1.36
MB
-rwxr-xr-x
cachestat-bpfcc
6.38
KB
-rwxr-xr-x
cachetop-bpfcc
9.15
KB
-rwxr-xr-x
capable-bpfcc
8.28
KB
-rwxr-xr-x
capable.bt
1.88
KB
-rwxr-xr-x
capsh
57.09
KB
-rwxr-xr-x
cfdisk
94.73
KB
-rwxr-xr-x
cgdisk
166.48
KB
-rwxr-xr-x
chcpu
30.38
KB
-rwxr-xr-x
check_forensic
952
B
-rwxr-xr-x
chgpasswd
58.32
KB
-rwxr-xr-x
chmem
34.38
KB
-rwxr-xr-x
chpasswd
54.43
KB
-rwxr-xr-x
chroot
38.51
KB
-rwxr-xr-x
cobjnew-bpfcc
53
B
-rwxr-xr-x
compactsnoop-bpfcc
11.1
KB
-rwxr-xr-x
cpgr
48.45
KB
-rwxr-xr-x
cppw
48.45
KB
-rwxr-xr-x
cpudist-bpfcc
6.85
KB
-rwxr-xr-x
cpuunclaimed-bpfcc
14.59
KB
-rwxr-xr-x
cpuwalk.bt
497
B
-rwxr-xr-x
criticalstat-bpfcc
8.41
KB
-rwxr-xr-x
cron
58.67
KB
-rwxr-xr-x
cryptdisks_start
1.51
KB
-rwxr-xr-x
cryptdisks_stop
844
B
-rwxr-xr-x
cryptsetup
225.9
KB
-rwxr-xr-x
ctrlaltdel
14.38
KB
-rwxr-xr-x
dbslower-bpfcc
7.22
KB
-rwxr-xr-x
dbstat-bpfcc
3.7
KB
-rwxr-xr-x
dcb
80.52
KB
-rwxr-xr-x
dcsnoop-bpfcc
4.03
KB
-rwxr-xr-x
dcsnoop.bt
1.23
KB
-rwxr-xr-x
dcstat-bpfcc
3.77
KB
-rwxr-xr-x
deadlock-bpfcc
20.45
KB
-rwxr-xr-x
debugfs
225.87
KB
-rwxr-xr-x
delgroup
18.53
KB
-rwxr-xr-x
deluser
18.53
KB
-rwxr-xr-x
depmod
170.24
KB
-rwxr-xr-x
devlink
150.86
KB
-rwxr-xr-x
dhcpcd
395.4
KB
-rwxr-xr-x
dirtop-bpfcc
8.37
KB
-rwxr-xr-x
dmeventd
50.38
KB
-rwxr-xr-x
dmidecode
135.25
KB
-rwxr-xr-x
dmsetup
171.05
KB
-rwxr-xr-x
dmstats
171.05
KB
-rwxr-xr-x
dosfsck
78.38
KB
-rwxr-xr-x
dosfslabel
38.38
KB
-rwxr-xr-x
dpkg-preconfigure
4.25
KB
-rwxr-xr-x
dpkg-reconfigure
4.43
KB
-rwxr-xr-x
drsnoop-bpfcc
6.73
KB
-rwxr-xr-x
dumpe2fs
34.31
KB
-rwxr-xr-x
e2freefrag
18.3
KB
-rwxr-xr-x
e2fsck
364.34
KB
-rwxr-xr-x
e2image
42.31
KB
-rwxr-xr-x
e2label
110.56
KB
-rwxr-xr-x
e2mmpstatus
34.31
KB
-rwxr-xr-x
e2scrub
7.12
KB
-rwxr-xr-x
e2scrub_all
5.27
KB
-rwxr-xr-x
e2undo
22.3
KB
-rwxr-xr-x
e4crypt
30.38
KB
-rwxr-xr-x
e4defrag
34.3
KB
-rwxr-xr-x
ebtables
219.16
KB
-rwxr-xr-x
ebtables-nft
219.16
KB
-rwxr-xr-x
ebtables-nft-restore
219.16
KB
-rwxr-xr-x
ebtables-nft-save
219.16
KB
-rwxr-xr-x
ebtables-restore
219.16
KB
-rwxr-xr-x
ebtables-save
219.16
KB
-rwxr-xr-x
ebtables-translate
219.16
KB
-rwxr-xr-x
era_check
1.36
MB
-rwxr-xr-x
era_dump
1.36
MB
-rwxr-xr-x
era_invalidate
1.36
MB
-rwxr-xr-x
era_restore
1.36
MB
-rwxr-xr-x
ethtool
651.68
KB
-rwxr-xr-x
execsnoop-bpfcc
9.82
KB
-rwxr-xr-x
execsnoop.bt
928
B
-rwxr-xr-x
exitsnoop-bpfcc
9.42
KB
-rwxr-xr-x
ext4dist-bpfcc
6.53
KB
-rwxr-xr-x
ext4slower-bpfcc
9.71
KB
-rwxr-xr-x
faillock
22.31
KB
-rwxr-xr-x
fatlabel
38.38
KB
-rwxr-xr-x
fdisk
114.42
KB
-rwxr-xr-x
filefrag
18.32
KB
-rwxr-xr-x
filegone-bpfcc
5.64
KB
-rwxr-xr-x
filelife-bpfcc
6.38
KB
-rwxr-xr-x
fileslower-bpfcc
7.2
KB
-rwxr-xr-x
filetop-bpfcc
6.35
KB
-rwxr-xr-x
findfs
14.38
KB
-rwxr-xr-x
fixparts
58.48
KB
-rwxr-xr-x
fsadm
24
KB
-rwxr-xr-x
fsck
42.42
KB
-rwxr-xr-x
fsck.btrfs
1.16
KB
-rwxr-xr-x
fsck.cramfs
30.44
KB
-rwxr-xr-x
fsck.ext2
364.34
KB
-rwxr-xr-x
fsck.ext3
364.34
KB
-rwxr-xr-x
fsck.ext4
364.34
KB
-rwxr-xr-x
fsck.fat
78.38
KB
-rwxr-xr-x
fsck.minix
54.41
KB
-rwxr-xr-x
fsck.msdos
78.38
KB
-rwxr-xr-x
fsck.vfat
78.38
KB
-rwxr-xr-x
fsck.xfs
2.51
KB
-rwxr-xr-x
fsfreeze
14.38
KB
-rwxr-xr-x
fstab-decode
14.3
KB
-rwxr-xr-x
fstrim
42.38
KB
-rwxr-xr-x
funccount-bpfcc
12.68
KB
-rwxr-xr-x
funcinterval-bpfcc
5.46
KB
-rwxr-xr-x
funclatency-bpfcc
11.28
KB
-rwxr-xr-x
funcslower-bpfcc
10.38
KB
-rwxr-xr-x
gdisk
198.48
KB
-rwxr-xr-x
genl
120.58
KB
-rwxr-xr-x
getcap
14.3
KB
-rwxr-xr-x
gethostlatency-bpfcc
3.82
KB
-rwxr-xr-x
gethostlatency.bt
1.19
KB
-rwxr-xr-x
getpcaps
14.3
KB
-rwxr-xr-x
getty
59.56
KB
-rwxr-xr-x
groupadd
71.13
KB
-rwxr-xr-x
groupdel
62.91
KB
-rwxr-xr-x
groupmems
58.34
KB
-rwxr-xr-x
groupmod
71.04
KB
-rwxr-xr-x
grpck
58.32
KB
-rwxr-xr-x
grpconv
50.16
KB
-rwxr-xr-x
grpunconv
50.16
KB
-rwxr-xr-x
grub-bios-setup
958.55
KB
-rwxr-xr-x
grub-install
1.17
MB
-rwxr-xr-x
grub-macbless
946.41
KB
-rwxr-xr-x
grub-mkconfig
8.63
KB
-rwxr-xr-x
grub-mkdevicemap
70.69
KB
-rwxr-xr-x
grub-probe
954.66
KB
-rwxr-xr-x
grub-reboot
4.73
KB
-rwxr-xr-x
grub-set-default
3.47
KB
-rwxr-xr-x
halt
1.43
MB
-rwxr-xr-x
hardirqs-bpfcc
6.85
KB
-rwxr-xr-x
hdparm
139.43
KB
-rwxr-xr-x
httxt2dbm
14.3
KB
-rwxr-xr-x
iconvconfig
34.47
KB
-rwxr-xr-x
ifconfig
77.17
KB
-rwxr-xr-x
iftop
62.62
KB
-rwxr-xr-x
init
98.45
KB
-rwxr-xr-x
inject-bpfcc
16.06
KB
-rwxr-xr-x
insmod
170.24
KB
-rwxr-xr-x
install-sgmlcatalog
4.44
KB
-rwxr-xr-x
installkernel
2.6
KB
-rwxr-xr-x
integritysetup
67.06
KB
-rwxr-xr-x
invoke-rc.d
16.13
KB
-rwxr-xr-x
iotop
113.64
KB
-rwxr-xr-x
iotop-c
113.64
KB
-rwxr-xr-x
ip
754.8
KB
-rwxr-xr-x
ip6tables
219.16
KB
-rwxr-xr-x
ip6tables-apply
6.89
KB
-rwxr-xr-x
ip6tables-legacy
92.95
KB
-rwxr-xr-x
ip6tables-legacy-restore
92.95
KB
-rwxr-xr-x
ip6tables-legacy-save
92.95
KB
-rwxr-xr-x
ip6tables-nft
219.16
KB
-rwxr-xr-x
ip6tables-nft-restore
219.16
KB
-rwxr-xr-x
ip6tables-nft-save
219.16
KB
-rwxr-xr-x
ip6tables-restore
219.16
KB
-rwxr-xr-x
ip6tables-restore-translate
219.16
KB
-rwxr-xr-x
ip6tables-save
219.16
KB
-rwxr-xr-x
ip6tables-translate
219.16
KB
-rwxr-xr-x
ipmaddr
18.3
KB
-rwxr-xr-x
iptables
219.16
KB
-rwxr-xr-x
iptables-apply
6.89
KB
-rwxr-xr-x
iptables-legacy
92.95
KB
-rwxr-xr-x
iptables-legacy-restore
92.95
KB
-rwxr-xr-x
iptables-legacy-save
92.95
KB
-rwxr-xr-x
iptables-nft
219.16
KB
-rwxr-xr-x
iptables-nft-restore
219.16
KB
-rwxr-xr-x
iptables-nft-save
219.16
KB
-rwxr-xr-x
iptables-restore
219.16
KB
-rwxr-xr-x
iptables-restore-translate
219.16
KB
-rwxr-xr-x
iptables-save
219.16
KB
-rwxr-xr-x
iptables-translate
219.16
KB
-rwxr-xr-x
iptunnel
18.3
KB
-rwxr-xr-x
iscsi-iname
18.3
KB
-rwxr-xr-x
iscsi_discovery
5.17
KB
-rwxr-xr-x
iscsiadm
370.43
KB
-rwxr-xr-x
iscsid
286.55
KB
-rwxr-xr-x
iscsistart
274.49
KB
-rwxr-xr-x
isosize
14.38
KB
-rwxr-xr-x
javacalls-bpfcc
55
B
-rwxr-xr-x
javaflow-bpfcc
54
B
-rwxr-xr-x
javagc-bpfcc
52
B
-rwxr-xr-x
javaobjnew-bpfcc
56
B
-rwxr-xr-x
javastat-bpfcc
54
B
-rwxr-xr-x
javathreads-bpfcc
57
B
-rwxr-xr-x
kbdrate
18.31
KB
-rwxr-xr-x
killall5
26.23
KB
-rwxr-xr-x
killsnoop-bpfcc
4.45
KB
-rwxr-xr-x
killsnoop.bt
873
B
-rwxr-xr-x
klockstat-bpfcc
13.04
KB
-rwxr-xr-x
kpartx
42.16
KB
-rwxr-xr-x
kvmexit-bpfcc
11.19
KB
-rwxr-xr-x
ldattach
26.38
KB
-rwxr-xr-x
ldconfig
387
B
-rwxr-xr-x
ldconfig.real
1
MB
-rwxr-xr-x
llcstat-bpfcc
4.48
KB
-rwxr-xr-x
loads.bt
1.1
KB
-rwxr-xr-x
locale-gen
4.21
KB
-rwxr-xr-x
logrotate
94.24
KB
-rwxr-xr-x
logsave
14.16
KB
-rwxr-xr-x
losetup
74.52
KB
-rwxr-xr-x
lsmod
170.24
KB
-rwxr-xr-x
luksformat
3.32
KB
-rwxr-xr-x
lvchange
3.01
MB
-rwxr-xr-x
lvconvert
3.01
MB
-rwxr-xr-x
lvcreate
3.01
MB
-rwxr-xr-x
lvdisplay
3.01
MB
-rwxr-xr-x
lvextend
3.01
MB
-rwxr-xr-x
lvm
3.01
MB
-rwxr-xr-x
lvmconfig
3.01
MB
-rwxr-xr-x
lvmdiskscan
3.01
MB
-rwxr-xr-x
lvmdump
10.12
KB
-rwxr-xr-x
lvmpolld
235.97
KB
-rwxr-xr-x
lvmsadc
3.01
MB
-rwxr-xr-x
lvmsar
3.01
MB
-rwxr-xr-x
lvreduce
3.01
MB
-rwxr-xr-x
lvremove
3.01
MB
-rwxr-xr-x
lvrename
3.01
MB
-rwxr-xr-x
lvresize
3.01
MB
-rwxr-xr-x
lvs
3.01
MB
-rwxr-xr-x
lvscan
3.01
MB
-rwxr-xr-x
lxc
589
B
-rwxr-xr-x
lxd
589
B
-rwxr-xr-x
make-bcache
22.38
KB
-rwxr-xr-x
make-ssl-cert
6.65
KB
-rwxr-xr-x
mariadbd
26.09
MB
-rwxr-xr-x
mdadm
622.21
KB
-rwxr-xr-x
mdflush-bpfcc
2.24
KB
-rwxr-xr-x
mdflush.bt
775
B
-rwxr-xr-x
mdmon
258.8
KB
-rwxr-xr-x
memleak-bpfcc
20.8
KB
-rwxr-xr-x
mii-tool
26.73
KB
-rwxr-xr-x
mkdosfs
50.83
KB
-rwxr-xr-x
mke2fs
130.62
KB
-rwxr-xr-x
mkfs
14.38
KB
-rwxr-xr-x
mkfs.bfs
22.38
KB
-rwxr-xr-x
mkfs.btrfs
560.3
KB
-rwxr-xr-x
mkfs.cramfs
34.32
KB
-rwxr-xr-x
mkfs.ext2
130.62
KB
-rwxr-xr-x
mkfs.ext3
130.62
KB
-rwxr-xr-x
mkfs.ext4
130.62
KB
-rwxr-xr-x
mkfs.fat
50.83
KB
-rwxr-xr-x
mkfs.minix
42.39
KB
-rwxr-xr-x
mkfs.msdos
50.83
KB
-rwxr-xr-x
mkfs.ntfs
66.38
KB
-rwxr-xr-x
mkfs.vfat
50.83
KB
-rwxr-xr-x
mkfs.xfs
438.99
KB
-rwxr-xr-x
mkhomedir_helper
22.34
KB
-rwxr-xr-x
mkinitramfs
15.39
KB
-rwxr-xr-x
mklost+found
14.3
KB
-rwxr-xr-x
mkntfs
66.38
KB
-rwxr-xr-x
mkswap
50.38
KB
-rwxr-xr-x
modinfo
170.24
KB
-rwxr-xr-x
modprobe
170.24
KB
-rwxr-xr-x
mount.fuse
18.3
KB
-rwxr-xr-x
mount.fuse3
18.3
KB
-rwxr-xr-x
mount.lowntfs-3g
118.98
KB
-rwxr-xr-x
mount.ntfs
159.01
KB
-rwxr-xr-x
mount.ntfs-3g
159.01
KB
-rwxr-xr-x
mountsnoop-bpfcc
14.62
KB
-rwxr-xr-x
mpathpersist
31.21
KB
-rwxr-xr-x
multipath
34.3
KB
-rwxr-xr-x
multipathc
18.3
KB
-rwxr-xr-x
multipathd
142.46
KB
-rwxr-xr-x
mysqld
26.09
MB
-rwxr-xr-x
mysqld_qslower-bpfcc
3.05
KB
-rwxr-xr-x
nameif
14.39
KB
-rwxr-xr-x
naptime.bt
1.01
KB
-rwxr-xr-x
needrestart
40.13
KB
-rwxr-xr-x
netplan
802
B
-rwxr-xr-x
netqtop-bpfcc
5.59
KB
-rwxr-xr-x
newusers
86.96
KB
-rwxr-xr-x
nfnl_osf
18.3
KB
-rwxr-xr-x
nfsdist-bpfcc
4.95
KB
-rwxr-xr-x
nfsslower-bpfcc
13.61
KB
-rwxr-xr-x
nft
26.23
KB
-rwxr-xr-x
nginx
1.25
MB
-rwxr-xr-x
nodegc-bpfcc
52
B
-rwxr-xr-x
nodestat-bpfcc
54
B
-rwxr-xr-x
nologin
14.3
KB
-rwxr-xr-x
ntfsclone
50.38
KB
-rwxr-xr-x
ntfscp
30.38
KB
-rwxr-xr-x
ntfslabel
22.38
KB
-rwxr-xr-x
ntfsresize
62.39
KB
-rwxr-xr-x
ntfsundelete
50.38
KB
-rwxr-xr-x
offcputime-bpfcc
13.46
KB
-rwxr-xr-x
offwaketime-bpfcc
15.31
KB
-rwxr-xr-x
on_ac_power
3.7
KB
-rwxr-xr-x
oomkill-bpfcc
2.04
KB
-rwxr-xr-x
oomkill.bt
1.17
KB
-rwxr-xr-x
opensnoop-bpfcc
14.24
KB
-rwxr-xr-x
opensnoop.bt
953
B
-rwxr-xr-x
overlayroot-chroot
2.45
KB
-rwxr-xr-x
ownership
14.45
KB
-rwxr-xr-x
pam-auth-update
20.96
KB
-rwxr-xr-x
pam_extrausers_chkpwd
26.31
KB
-rwxr-sr-x
pam_extrausers_update
34.31
KB
-rwxr-xr-x
pam_getenv
2.82
KB
-rwxr-xr-x
pam_namespace_helper
467
B
-rwxr-xr-x
pam_timestamp_check
14.31
KB
-rwxr-xr-x
parted
94.4
KB
-rwxr-xr-x
partprobe
14.38
KB
-rwxr-xr-x
pdata_tools
1.36
MB
-rwxr-xr-x
perlcalls-bpfcc
55
B
-rwxr-xr-x
perlflow-bpfcc
54
B
-rwxr-xr-x
perlstat-bpfcc
54
B
-rwxr-xr-x
php-fpm8.3
5.49
MB
-rwxr-xr-x
phpcalls-bpfcc
54
B
-rwxr-xr-x
phpdismod
7.11
KB
-rwxr-xr-x
phpenmod
7.11
KB
-rwxr-xr-x
phpflow-bpfcc
53
B
-rwxr-xr-x
phpquery
6.24
KB
-rwxr-xr-x
phpstat-bpfcc
53
B
-rwxr-xr-x
pidpersec-bpfcc
1.08
KB
-rwxr-xr-x
pidpersec.bt
628
B
-rwxr-xr-x
pivot_root
14.38
KB
-rwxr-xr-x
plipconfig
14.3
KB
-rwxr-xr-x
plymouthd
146.57
KB
-rwxr-xr-x
poweroff
1.43
MB
-rwxr-xr-x
ppchcalls-bpfcc
13.89
KB
-rwxr-xr-x
profile-bpfcc
14.41
KB
-rwxr-xr-x
pvchange
3.01
MB
-rwxr-xr-x
pvck
3.01
MB
-rwxr-xr-x
pvcreate
3.01
MB
-rwxr-xr-x
pvdisplay
3.01
MB
-rwxr-xr-x
pvmove
3.01
MB
-rwxr-xr-x
pvremove
3.01
MB
-rwxr-xr-x
pvresize
3.01
MB
-rwxr-xr-x
pvs
3.01
MB
-rwxr-xr-x
pvscan
3.01
MB
-rwxr-xr-x
pwck
54.29
KB
-rwxr-xr-x
pwconv
46.16
KB
-rwxr-xr-x
pwhistory_helper
22.31
KB
-rwxr-xr-x
pwunconv
46.16
KB
-rwxr-xr-x
pythoncalls-bpfcc
57
B
-rwxr-xr-x
pythonflow-bpfcc
56
B
-rwxr-xr-x
pythongc-bpfcc
54
B
-rwxr-xr-x
pythonstat-bpfcc
56
B
-rwxr-xr-x
rarp
32.33
KB
-rwxr-xr-x
rdmaucma-bpfcc
4.95
KB
-rwxr-xr-x
readahead-bpfcc
6.54
KB
-rwxr-xr-x
readprofile
22.41
KB
-rwxr-xr-x
reboot
1.43
MB
-rwxr-xr-x
remove-shell
1.08
KB
-rwxr-xr-x
reset-trace-bpfcc
3.42
KB
-rwxr-xr-x
resize2fs
70.3
KB
-rwxr-xr-x
resolvconf
158.67
KB
-rwxr-xr-x
rmmod
170.24
KB
-rwxr-xr-x
rmt
54.71
KB
-rwxr-xr-x
rmt-tar
54.71
KB
-rwxr-xr-x
route
68.27
KB
-rwxr-xr-x
rsyslogd
771.67
KB
-rwxr-xr-x
rtacct
28.31
KB
-rwxr-xr-x
rtcwake
34.38
KB
-rwxr-xr-x
rtmon
116.52
KB
-rwxr-xr-x
rubycalls-bpfcc
55
B
-rwxr-xr-x
rubyflow-bpfcc
54
B
-rwxr-xr-x
rubygc-bpfcc
52
B
-rwxr-xr-x
rubyobjnew-bpfcc
56
B
-rwxr-xr-x
rubystat-bpfcc
54
B
-rwxr-xr-x
runlevel
1.43
MB
-rwxr-xr-x
runqlat-bpfcc
9.3
KB
-rwxr-xr-x
runqlat.bt
788
B
-rwxr-xr-x
runqlen-bpfcc
8.05
KB
-rwxr-xr-x
runqlen.bt
1.01
KB
-rwxr-xr-x
runqslower-bpfcc
9.01
KB
-rwxr-xr-x
runuser
54.38
KB
-rwxr-xr-x
service
8.89
KB
-rwxr-xr-x
setcap
14.3
KB
-rwxr-xr-x
setuids.bt
1.76
KB
-rwxr-xr-x
setvesablank
14.37
KB
-rwxr-xr-x
setvtrgb
14.43
KB
-rwxr-xr-x
sfdisk
106.38
KB
-rwxr-xr-x
sgdisk
178.48
KB
-rwxr-xr-x
shadowconfig
2.22
KB
-rwxr-xr-x
shmsnoop-bpfcc
7.8
KB
-rwxr-xr-x
shutdown
1.43
MB
-rwxr-xr-x
slabratetop-bpfcc
6.38
KB
-rwxr-xr-x
slattach
36.08
KB
-rwxr-xr-x
sofdsnoop-bpfcc
8.06
KB
-rwxr-xr-x
softirqs-bpfcc
5.59
KB
-rwxr-xr-x
solisten-bpfcc
5.96
KB
-rwxr-xr-x
split-logfile
2.36
KB
-rwxr-xr-x
sshd
899.82
KB
-rwxr-xr-x
ssllatency.bt
2.08
KB
-rwxr-xr-x
sslsniff-bpfcc
13.68
KB
-rwxr-xr-x
sslsnoop.bt
1.99
KB
-rwxr-xr-x
stackcount-bpfcc
16.26
KB
-rwxr-xr-x
start-stop-daemon
47.49
KB
-rwxr-xr-x
statsnoop-bpfcc
4.92
KB
-rwxr-xr-x
statsnoop.bt
1.26
KB
-rwxr-xr-x
sudo_logsrvd
248.5
KB
-rwxr-xr-x
sudo_sendlog
131.67
KB
-rwxr-xr-x
sulogin
42.38
KB
-rwxr-xr-x
swapin.bt
600
B
-rwxr-xr-x
swaplabel
18.38
KB
-rwxr-xr-x
swapoff
22.38
KB
-rwxr-xr-x
swapon
42.38
KB
-rwxr-xr-x
switch_root
22.38
KB
-rwxr-xr-x
syncsnoop-bpfcc
1.27
KB
-rwxr-xr-x
syncsnoop.bt
839
B
-rwxr-xr-x
syscount-bpfcc
8.57
KB
-rwxr-xr-x
syscount.bt
872
B
-rwxr-xr-x
sysctl
30.38
KB
-rwxr-xr-x
tarcat
936
B
-rwxr-xr-x
tc
630.08
KB
-rwxr-xr-x
tclcalls-bpfcc
54
B
-rwxr-xr-x
tclflow-bpfcc
53
B
-rwxr-xr-x
tclobjnew-bpfcc
55
B
-rwxr-xr-x
tclstat-bpfcc
53
B
-rwxr-xr-x
tcpaccept-bpfcc
9
KB
-rwxr-xr-x
tcpaccept.bt
1.71
KB
-rwxr-xr-x
tcpcong-bpfcc
20.11
KB
-rwxr-xr-x
tcpconnect-bpfcc
18.46
KB
-rwxr-xr-x
tcpconnect.bt
1.58
KB
-rwxr-xr-x
tcpconnlat-bpfcc
9.07
KB
-rwxr-xr-x
tcpdrop-bpfcc
7.44
KB
-rwxr-xr-x
tcpdrop.bt
2.41
KB
-rwxr-xr-x
tcplife-bpfcc
16.55
KB
-rwxr-xr-x
tcplife.bt
2.72
KB
-rwxr-xr-x
tcpretrans-bpfcc
13.77
KB
-rwxr-xr-x
tcpretrans.bt
2.07
KB
-rwxr-xr-x
tcprtt-bpfcc
8.7
KB
-rwxr-xr-x
tcpstates-bpfcc
13.73
KB
-rwxr-xr-x
tcpsubnet-bpfcc
7.63
KB
-rwxr-xr-x
tcpsynbl-bpfcc
2.12
KB
-rwxr-xr-x
tcpsynbl.bt
962
B
-rwxr-xr-x
tcptop-bpfcc
12.64
KB
-rwxr-xr-x
tcptracer-bpfcc
17.71
KB
-rwxr-xr-x
telinit
1.43
MB
-rwxr-xr-x
thin_check
1.36
MB
-rwxr-xr-x
thin_delta
1.36
MB
-rwxr-xr-x
thin_dump
1.36
MB
-rwxr-xr-x
thin_ls
1.36
MB
-rwxr-xr-x
thin_metadata_size
1.36
MB
-rwxr-xr-x
thin_repair
1.36
MB
-rwxr-xr-x
thin_restore
1.36
MB
-rwxr-xr-x
thin_rmap
1.36
MB
-rwxr-xr-x
thin_trim
1.36
MB
-rwxr-xr-x
threadsnoop-bpfcc
1.81
KB
-rwxr-xr-x
threadsnoop.bt
712
B
-rwxr-xr-x
tipc
90.52
KB
-rwxr-xr-x
tplist-bpfcc
4.06
KB
-rwxr-xr-x
trace-bpfcc
42.86
KB
-rwxr-xr-x
ttysnoop-bpfcc
7.51
KB
-rwxr-xr-x
tune2fs
110.56
KB
-rwxr-xr-x
ucalls
11.69
KB
-rwxr-xr-x
uflow
7.92
KB
-rwxr-xr-x
ufw
4.84
KB
-rwxr-xr-x
ugc
7.64
KB
-rwxr-xr-x
umount.udisks2
14.3
KB
-rwxr-xr-x
undump.bt
789
B
-rwxr-xr-x
unix_chkpwd
30.31
KB
-rwxr-sr-x
unix_update
34.31
KB
-rwxr-xr-x
uobjnew
6.04
KB
-rwxr-xr-x
update-ca-certificates
5.32
KB
-rwxr-xr-x
update-catalog
9.17
KB
-rwxr-xr-x
update-grub
64
B
-rwxr-xr-x
update-grub-gfxpayload
301
B
-rwxr-xr-x
update-grub2
64
B
-rwxr-xr-x
update-ieee-data
3.41
KB
-rwxr-xr-x
update-info-dir
1.66
KB
-rwxr-xr-x
update-initramfs
6.75
KB
-rwxr-xr-x
update-locale
2.99
KB
-rwxr-xr-x
update-passwd
34.56
KB
-rwxr-xr-x
update-pciids
1.74
KB
-rwxr-xr-x
update-rc.d
17.72
KB
-rwxr-xr-x
update-secureboot-policy
7.43
KB
-rwxr-xr-x
update-shells
3.89
KB
-rwxr-xr-x
update-xmlcatalog
16.88
KB
-rwxr-xr-x
upgrade-from-grub-legacy
1.56
KB
-rwxr-xr-x
usb_modeswitch
59.66
KB
-rwxr-xr-x
usb_modeswitch_dispatcher
26.78
KB
-rwxr-xr-x
useradd
139.88
KB
-rwxr-xr-x
userdel
91.01
KB
-rwxr-xr-x
usermod
127.65
KB
-rwxr-xr-x
ustat
12.12
KB
-rwxr-xr-x
uthreads
4
KB
-rwxr-xr-x
uuidd
30.88
KB
-rwxr-xr-x
validlocale
1.73
KB
-rwxr-xr-x
vcstime
14.3
KB
-rwxr-xr-x
vdpa
34.56
KB
-rwxr-xr-x
veritysetup
43.94
KB
-rwxr-xr-x
vfscount-bpfcc
1.36
KB
-rwxr-xr-x
vfscount.bt
515
B
-rwxr-xr-x
vfsstat-bpfcc
4.06
KB
-rwxr-xr-x
vfsstat.bt
721
B
-rwxr-xr-x
vgcfgbackup
3.01
MB
-rwxr-xr-x
vgcfgrestore
3.01
MB
-rwxr-xr-x
vgchange
3.01
MB
-rwxr-xr-x
vgck
3.01
MB
-rwxr-xr-x
vgconvert
3.01
MB
-rwxr-xr-x
vgcreate
3.01
MB
-rwxr-xr-x
vgdisplay
3.01
MB
-rwxr-xr-x
vgexport
3.01
MB
-rwxr-xr-x
vgextend
3.01
MB
-rwxr-xr-x
vgimport
3.01
MB
-rwxr-xr-x
vgimportclone
3.01
MB
-rwxr-xr-x
vgmerge
3.01
MB
-rwxr-xr-x
vgmknodes
3.01
MB
-rwxr-xr-x
vgreduce
3.01
MB
-rwxr-xr-x
vgremove
3.01
MB
-rwxr-xr-x
vgrename
3.01
MB
-rwxr-xr-x
vgs
3.01
MB
-rwxr-xr-x
vgscan
3.01
MB
-rwxr-xr-x
vgsplit
3.01
MB
-rwxr-xr-x
vigr
60.69
KB
-rwxr-xr-x
vipw
60.69
KB
-rwxr-xr-x
virtiostat-bpfcc
8.69
KB
-rwxr-xr-x
visudo
252.71
KB
-rwxr-xr-x
vnstatd
93.28
KB
-rwxr-xr-x
vpddecode
14.58
KB
-rwxr-xr-x
vsftpd
156.48
KB
-rwxr-xr-x
wakeuptime-bpfcc
8.1
KB
-rwxr-xr-x
wipefs
38.38
KB
-rwxr-xr-x
writeback.bt
1.66
KB
-rwxr-xr-x
xfs_admin
2.12
KB
-rwxr-xr-x
xfs_bmap
695
B
-rwxr-xr-x
xfs_copy
90.44
KB
-rwxr-xr-x
xfs_db
688.56
KB
-rwxr-xr-x
xfs_estimate
14.16
KB
-rwxr-xr-x
xfs_freeze
800
B
-rwxr-xr-x
xfs_fsr
42.18
KB
-rwxr-xr-x
xfs_growfs
38.23
KB
-rwxr-xr-x
xfs_info
1.26
KB
-rwxr-xr-x
xfs_io
203.65
KB
-rwxr-xr-x
xfs_logprint
78.27
KB
-rwxr-xr-x
xfs_mdrestore
34.23
KB
-rwxr-xr-x
xfs_metadump
816
B
-rwxr-xr-x
xfs_mkfile
1.02
KB
-rwxr-xr-x
xfs_ncheck
685
B
-rwxr-xr-x
xfs_quota
90.16
KB
-rwxr-xr-x
xfs_repair
643.32
KB
-rwxr-xr-x
xfs_rtcp
18.15
KB
-rwxr-xr-x
xfs_scrub
106.27
KB
-rwxr-xr-x
xfs_scrub_all
7.66
KB
-rwxr-xr-x
xfs_spaceman
42.3
KB
-rwxr-xr-x
xfsdist-bpfcc
4.61
KB
-rwxr-xr-x
xfsdist.bt
972
B
-rwxr-xr-x
xfsslower-bpfcc
7.78
KB
-rwxr-xr-x
xtables-legacy-multi
92.95
KB
-rwxr-xr-x
xtables-monitor
219.16
KB
-rwxr-xr-x
xtables-nft-multi
219.16
KB
-rwxr-xr-x
zerofree
14.15
KB
-rwxr-xr-x
zfsdist-bpfcc
5.3
KB
-rwxr-xr-x
zfsslower-bpfcc
8.45
KB
-rwxr-xr-x
zic
66.39
KB
-rwxr-xr-x
zramctl
54.52
KB
-rwxr-xr-x
Delete
Unzip
Zip
${this.title}
Close
Code Editor : adduser
#! /usr/bin/perl # Copyright (C) 2000-2004 Roland Bauerschmidt <rb@debian.org> # 2005-2023 Marc Haber <mh+debian-packages@zugschlus.de> # 2022 Benjamin Drung <benjamin.drung@canonical.com> # 2023 Guillem Jover <guillem@debian.org> # 2021-2022 Jason Franklin <jason@oneway.dev> # 2022 Matt Barry <matt@hazelmollusk.org> # 2016-2017 Afif Elghraoui <afif@debian.org> # 2016 Dr. Helge Kreutzmann <debian@helgefjell.de> # 2005-2009 Joerg Hoh <joerg@joerghoh.de> # 2006-2011 Stephen Gran <sgran@debian.org> # # Original adduser: # Copyright (C) 1997-1999 Guy Maor <maor@debian.org> # # Copyright (C) 1995 Ted Hajek <tedhajek@boombox.micro.umn.edu> # Ian A. Murdock <imurdock@gnu.ai.mit.edu> # # The general scheme of this program was adapted from the original # Debian "adduser" program by Ian A. Murdock <imurdock@gnu.ai.mit.edu>. # # License: GPL-2+ use 5.32.0; use strict; use warnings; use Getopt::Long; use Debian::AdduserCommon 3.136; use Debian::AdduserLogging 3.136; use Debian::AdduserRetvalues 3.136; BEGIN { if ( Debian::AdduserCommon->VERSION != version->declare('3.136') || Debian::AdduserLogging->VERSION != version->declare('3.136') || Debian::AdduserRetvalues->VERSION != version->declare('3.136') ) { die "wrong module version in adduser, check your packaging or path"; } } my $version = "3.137ubuntu1"; BEGIN { local $ENV{PERL_DL_NONLAZY}=1; # we need to disable perlcritic here since this construct # needs experession form eval, see perl cookbook 12.2.3 ## no critic eval " require POSIX; import POSIX qw(setlocale); "; ## use critic if ($@) { *setlocale = sub { return 1 }; } else { setlocale( &POSIX::LC_MESSAGES, "" ); } ## no critic eval " require I18N::Langinfo; import I18N::Langinfo qw(langinfo YESEXPR NOEXPR); "; ## use critic if ($@) { *langinfo = sub { return shift; }; *YESEXPR = sub { "^[yY]" }; *NOEXPR = sub { "^[nN]" }; } } my $yesexpr = langinfo(YESEXPR()); my %config; # configuration hash my $nogroup_id = getgrnam("nogroup") || 65534; $0 =~ s+.*/++; our $verbose = 1; # should we be verbose? my $name_check_level = 0; # should we allow bad names? our $stderrmsglevel = "warn"; our $stdoutmsglevel = "info"; our $logmsglevel = "info"; my $allow_badname = 0; # should we allow bad names? my $ask_passwd = 1; # ask for a passwd? my $disabled_login = 0; # leave the new account disabled? our @configfiles; our @defaults = undef; our $encrypt_home = undef; our $found_group_opt = undef; our $found_sys_opt = undef; our $ingroup_name = undef; our $new_firstgid = undef; our $new_firstuid = undef; our $new_comment = undef; our $gid_option = undef; our $primary_gid = undef; our $new_lastgid = undef; our $new_lastuid = undef; our $new_uid = undef; our $no_create_home = undef; our $special_home = undef; our $special_shell = undef; our $use_extrausers = 0; our $add_extra_groups; our $add_extra_groups_old; # Global variables we need later my $existing_user = undef; my $existing_group = undef; my $new_name = undef; my $make_group_also = 0; my $home_dir = undef; my $undohome = undef; my $undouser = undef; my $undogroup = undef; my $shell = undef; my $first_uid = undef; my $last_uid = undef; my $first_gid = undef; my $last_gid = undef; my $dir_mode = undef; my $perm = undef; my %uid_pool; my %gid_pool; our @names; GetOptions( 'add-extra-groups' => \$add_extra_groups, 'add_extra_groups' => \$add_extra_groups_old, 'allow-all-names' => sub { $name_check_level = 2 }, 'allow-badname' => sub { $name_check_level = 1 unless $name_check_level }, 'allow-bad-names' => sub { $name_check_level = 1 unless $name_check_level }, 'comment=s' => \$new_comment, 'conf|c=s' => \@configfiles, 'debug' => sub { $verbose = 2 }, 'stdoutmsglevel=s' => \$stdoutmsglevel, 'stderrmsglevel=s' => \$stderrmsglevel, 'logmsglevel=s' => \$logmsglevel, 'disabled-login' => sub { $disabled_login = 1; $ask_passwd = 0 }, 'disabled-password' => sub { $ask_passwd = 0 }, 'encrypt-home' => \$encrypt_home, 'extrausers' => \$use_extrausers, 'firstgid=i' => \$new_firstgid, 'firstuid=i' => \$new_firstuid, 'force-badname' => sub { $name_check_level = 1 unless $name_check_level }, 'gecos=s' => \$new_comment, 'gid=i' => \$gid_option, 'group' => \$found_group_opt, 'help|h' => sub { &usage; exit }, 'home=s' => \$special_home, 'ingroup=s' => \$ingroup_name, 'lastgid=i' => \$new_lastgid, 'lastuid=i' => \$new_lastuid, 'no-create-home' => \$no_create_home, 'quiet|q' => sub { $verbose = 0 }, 'shell=s' => \$special_shell, 'system' => \$found_sys_opt, 'uid=i' => \$new_uid, 'verbose' => sub { $verbose = 1 }, 'version|v' => sub { &version; exit }, ) or &usage_error; if(!@configfiles) { @defaults = ("/etc/adduser.conf"); } else { @defaults = (@configfiles); } # preseed configuration data and then read the config file preseed_config(\@defaults,\%config); # everyone can issue "--help" and "--version", but only root can go on if( $> != 0) { log_fatal( mtx("Only root may add a user or group to the system.") ); exit( RET_ROOT_NEEDED ); } # TODO: Handle configuration file input, allow bare input there. if( $verbose == 0 ) { set_msglevel( $stderrmsglevel, "warn", $logmsglevel ); } elsif( $verbose == 1 ) { set_msglevel( $stderrmsglevel, "info", $logmsglevel ); } elsif( $verbose == 2 ) { set_msglevel( $stderrmsglevel, "debug", $logmsglevel ); } else { set_msglevel( $stderrmsglevel, $stdoutmsglevel, $logmsglevel ); } # detect the right mode my $action = $0 eq "addgroup" ? "addgroup" : "adduser"; if (defined($found_sys_opt)) { $action = "addsysuser" if ($action eq "adduser"); $action = "addsysgroup" if ($action eq "addgroup"); } # explicitly set PATH, because super (1) cleans up the path and makes adduser unusable; # this is also a good idea for sudo (which doesn't clean up) $ENV{"PATH"}="/bin:/usr/bin:/sbin:/usr/sbin"; $ENV{"IFS"}=" \t\n"; ############################ # checks related to @names # ############################ while (defined(my $arg = shift(@ARGV))) { push (@names, $arg); } if ( (! defined $names[0]) || length($names[0]) == 0 || @names > 2) { log_fatal( mtx("Only one or two names allowed.") ); exit( RET_INVALID_CALL ); } if (@names == 2) { # must be addusertogroup if ($action eq "addsysuser" || $found_group_opt) { log_fatal( mtx("Specify only one name in this mode.") ); exit( RET_INVALID_CALL ); } if ($action eq "addgroup" or $action eq "addsysgroup") { log_fatal( mtx("addgroup with two arguments is an unspecified operation.") ); exit( RET_INVALID_CALL ); } $action = "addusertogroup"; $existing_user = shift (@names); $existing_group = shift (@names); } else { # 1 parameter, must be adduser $new_name = shift (@names); } ################################### # check for consistent parameters # ################################### if (!defined $add_extra_groups) { if( defined $add_extra_groups_old ) { $add_extra_groups = $add_extra_groups_old; } else { $add_extra_groups = 0; } } if ($action ne "addgroup" && defined($found_group_opt) +defined($ingroup_name) +defined($gid_option) > 1 ) { log_fatal( mtx("The --group, --ingroup, and --gid options are mutually exclusive.") ); exit( RET_EXCLUSIVE_PARAMETERS ); } if ((defined($special_home)) && ($special_home !~ m+^/+ )) { log_fatal( mtx("The home dir must be an absolute path.") ); exit( RET_INVALID_HOME_DIRECTORY ); } if (defined($special_home)) { if (!defined($no_create_home) && -d $special_home) { log_info( mtx("The home dir %s you specified already exists.\n"), $special_home ); } if (defined($no_create_home) && ! -d $special_home) { log_info( mtx("The home dir %s you specified can't be accessed: %s\n"), $special_home, $! ); } } if ($found_group_opt) { if ($action eq "addsysuser") { $make_group_also = 1; } elsif ($found_sys_opt) { $action = "addsysgroup"; } else { $action = "addgroup"; } } my $ecryptfs_setup_private; if (defined($encrypt_home)) { $ecryptfs_setup_private = &which('ecryptfs-setup-private'); } # TODO: map this to log levels $ENV{"VERBOSE"} = $verbose; $ENV{"DEBUG"} = $verbose; # preseed_config was moved from here # read the uid and gid pool if ($config{"uid_pool"}) { read_pool ($config{"uid_pool"}, "uid", \%uid_pool); } if ($config{"gid_pool"}) { read_pool ($config{"gid_pool"}, "gid", \%gid_pool); } &checkname($new_name) if defined $new_name; $SIG{'INT'} = $SIG{'QUIT'} = $SIG{'HUP'} = 'handler'; ##### # OK, we've processed the arguments. $action equals one of the following, # and the appropriate variables have been set: # # $action = "adduser" # $new_name - the name of the new user. # $ingroup_name | $gid_option - the group to add the user to # $special_home, $new_uid, $new_comment - optional overrides # $action = "addgroup" # $new_name - the name of the new group # $gid_option - optional override # $action = "addsysgroup" # $new_name - the name of the new group # $gid_option - optional override # $action = "addsysuser" # $new_name - the name of the new user # $make_group_also | $ingroup_name | $gid_option | 0 - which group # $special_home, $new_uid, $new_comment - optional overrides # $action = "addusertogroup" # $existing_user - the user to be added # $existing_group - the group to add her to ##### ################# ## addsysgroup ## ################# if ($action eq "addsysgroup") { acquire_lock(); # Check if requested group already exists and we can exit safely my $ret = existing_group_ok($new_name, $gid_option); if ($ret == 3) { log_info( mtx("The group `%s' already exists as a system group. Exiting."), $new_name ); exit( RET_OK ); } if ($ret == 1) { log_err( mtx("The group `%s' already exists and is not a system group. Exiting."), $new_name ); exit( RET_WRONG_OBJECT_PROPERTIES ); } if ($ret == 2) { log_err( mtx("The group `%s' already exists, but has a different GID. Exiting."), $new_name ); exit( RET_WRONG_OBJECT_PROPERTIES ); } if (defined($gid_option) && defined(getgrgid($gid_option))) { log_fatal( mtx("The GID `%s' is already in use."), $gid_option ); exit( RET_ID_IN_USE ); } if (!defined($gid_option)) { $first_gid = $new_firstgid || $config{"first_system_gid"}; $last_gid = $new_lastgid || $config{"last_system_gid"}; $gid_option = &first_avail_gid($first_gid, $last_gid, $gid_pool{$new_name}{'id'}); if ($gid_option == -1) { log_warn( mtx("No GID is available in the range %d-%d (FIRST_SYS_GID - LAST_SYS_GID)."), $first_gid, $last_gid ); log_err( mtx("The group `%s' was not created."), $new_name ); exit( RET_NO_ID_IN_RANGE ); } } log_info( mtx("Adding group `%s' (GID %d) ..."), $new_name, $gid_option); my $groupadd = &which('groupadd'); if ( ($use_extrausers) || ($config{"use_extrausers"}) ) { &systemcall($groupadd, '--extrausers', '-g', $gid_option, $new_name); } else { &systemcall($groupadd, '-g', $gid_option, $new_name); } release_lock(0); exit( RET_OK ); } ############## ## addgroup ## ############## if ($action eq "addgroup") { acquire_lock(); if (defined getgrnam($new_name)) { log_fatal( mtx("The group `%s' already exists."), $new_name); exit( RET_OBJECT_EXISTS ); } if (defined($gid_option) && defined(getgrgid($gid_option))) { log_fatal( mtx("The GID `%s' is already in use."), $gid_option ); exit( RET_ID_IN_USE ); } if (!defined($gid_option)) { $first_gid = $new_firstgid || $config{"first_gid"}; $last_gid = $new_lastgid || $config{"last_gid"}; log_debug( "Searching for gid with first_gid=%s, last_gid=%s, new_name=%s, gid_pool=%s", $first_gid, $last_gid, $new_name, $gid_pool{$new_name}{'id'} ); $gid_option = &first_avail_gid($first_gid, $last_gid, $gid_pool{$new_name}{'id'}); if ($gid_option == -1) { log_warn( mtx("No GID is available in the range %d-%d (FIRST_GID - LAST_GID)."), $first_gid, $last_gid ); log_fatal( mtx("The group `%s' was not created."), $new_name ); exit( RET_NO_ID_IN_RANGE ); } } log_info( mtx("Adding group `%s' (GID %d) ..."), $new_name, $gid_option); my $groupadd = &which('groupadd'); if ( ($use_extrausers) || ($config{"use_extrausers"}) ) { &systemcall($groupadd, '--extrausers', '-g', $gid_option, $new_name); } else { &systemcall($groupadd, '-g', $gid_option, $new_name); } release_lock(0); exit( RET_OK ); } #################### ## addusertogroup ## #################### if ($action eq 'addusertogroup') { if (!defined getpwnam($existing_user)) { log_fatal( mtx("The user `%s' does not exist."), $existing_user ); exit( RET_OBJECT_DOES_NOT_EXIST ); } if (!defined getgrnam($existing_group)) { log_fatal( mtx("The group `%s' does not exist."), $existing_group ); exit( RET_OBJECT_DOES_NOT_EXIST ); } if (&user_is_member($existing_user, $existing_group)) { log_info( mtx("The user `%s' is already a member of `%s'."), $existing_user, $existing_group ); exit( RET_OK ); } log_info( mtx("Adding user `%s' to group `%s' ..."), $existing_user, $existing_group ); acquire_lock(); if ( ($use_extrausers) || ($config{"use_extrausers"}) ) { &systemcall('/usr/sbin/usermod', '--extrausers', '-a', '-G', $existing_group, $existing_user); } else { &systemcall('/usr/sbin/usermod', '-a', '-G', $existing_group, $existing_user); } release_lock(); exit( RET_OK ); } ################ ## addsysuser ## ################ if ($action eq "addsysuser") { acquire_lock(); if (existing_user_ok($new_name, $new_uid) == 1) { # a user with this name already exists; it's a problem when it's not a system user my $tmp_u = getpwnam($new_name); if (($tmp_u >= $config{"first_system_uid"}) and ($tmp_u <= $config{"last_system_uid"})) { log_info( mtx("The system user `%s' already exists. Exiting.\n"), $new_name ); exit( RET_OK ); } log_fatal( mtx("The user `%s' already exists, but is not a system user. Exiting."), $new_name ); exit( RET_WRONG_OBJECT_PROPERTIES ); } if (existing_user_ok($new_name, $new_uid) == 2) { log_fatal( mtx("The user `%s' already exists with a different UID. Exiting."), $new_name ); exit( RET_WRONG_OBJECT_PROPERTIES ); } if (!$ingroup_name && !defined($gid_option) && !$make_group_also) { $gid_option = $nogroup_id; } check_user_group(1); if (!defined($new_uid) && $make_group_also) { $new_uid = &first_avail_uid($new_firstuid || $config{"first_system_uid"}, $new_lastuid || $config{"last_system_uid"}, $uid_pool{$new_name}{'id'}); if ($new_uid == -1) { log_warn( mtx("No UID/GID pair is available in the range %d-%d (FIRST_SYS_UID - LAST_SYS_UID)."), $config{"first_system_uid"}, $config{"last_system_uid"} ); log_fatal( mtx("The user `%s' was not created."), $new_name ); exit( RET_NO_ID_IN_RANGE ); } $gid_option = &first_avail_gid($new_firstgid || $config{"first_system_gid"}, $new_lastgid || $config{"last_system_gid"}, $gid_pool{$new_name}{'id'}); $ingroup_name = $new_name; } elsif (!defined($new_uid) && !$make_group_also) { $new_uid = &first_avail_uid($new_firstuid || $config{"first_system_uid"}, $new_lastuid || $config{"last_system_uid"}, $uid_pool{$new_name}{'id'}); if ($new_uid == -1) { log_warn( mtx("No UID is available in the range %d-%d (FIRST_SYS_UID - LAST_SYS_UID)."), $config{"first_system_uid"}, $config{"last_system_uid"} ); log_fatal( mtx("The user `%s' was not created."), $new_name); exit( RET_NO_ID_IN_RANGE ); } if (defined($gid_option)) { $ingroup_name = getgrgid($gid_option); } elsif ($ingroup_name) { $gid_option = getgrnam($ingroup_name); } else { log_fatal( mtx("Neither ingroup option nor gid given.") ); exit( RET_NO_PRIMARY_GROUP ); } } else { if (defined($gid_option)) { $ingroup_name = getgrgid($gid_option); } elsif ($ingroup_name) { $gid_option = getgrnam($ingroup_name); } elsif ($make_group_also) { $gid_option=$new_uid; $ingroup_name=$new_name; } else { log_fatal( mtx("Neither ingroup option nor gid given and make_group_also unset.") ); exit( RET_NO_PRIMARY_GROUP ); } } log_info( mtx("Adding system user `%s' (UID %d) ..."), $new_name, $new_uid ); # if we reach this point, and the group does already exist, we can use it. if ($make_group_also && !getgrnam($new_name)) { log_info( mtx("Adding new group `%s' (GID %d) ..."), $new_name, $gid_option ); $undogroup = $new_name; my $groupadd = &which('groupadd'); if ( ($use_extrausers) || ($config{"use_extrausers"}) ) { &systemcall($groupadd, '--extrausers', '-g', $gid_option, $new_name); } else { &systemcall($groupadd, '-g', $gid_option, $new_name); } } log_info( mtx("Adding new user `%s' (UID %d) with group `%s' ..."), $new_name, $new_uid, $ingroup_name ); $home_dir = $special_home || $uid_pool{$new_name}{'home'} || '/nonexistent'; $no_create_home = $home_dir =~ /^\/+nonexistent(\/|$)/ ? 1 : $no_create_home; $shell = $special_shell || $uid_pool{$new_name}{'shell'} || '/usr/sbin/nologin'; $undouser = $new_name; if ( ($use_extrausers) || ($config{"use_extrausers"}) ) { &systemcall('/usr/sbin/useradd', '--extrausers', '-r', '-K', sprintf('SYS_UID_MIN=%d', $config{'first_system_uid'}), '-K', sprintf('SYS_UID_MAX=%d', $config{'last_system_uid'}), '-d', $home_dir, '-g', $ingroup_name, '-s', $shell, '-u', $new_uid, $new_name); } else { &systemcall('/usr/sbin/useradd', '-r', '-K', sprintf('SYS_UID_MIN=%d', $config{'first_system_uid'}), '-K', sprintf('SYS_UID_MAX=%d', $config{'last_system_uid'}), '-d', $home_dir, '-g', $ingroup_name, '-s', $shell, '-u', $new_uid, $new_name); } release_lock(0); if (defined($new_comment)) { &ch_comment($new_comment); } elsif ($uid_pool{$new_name}{'comment'}) { &ch_comment($uid_pool{$new_name}{'comment'}); } $primary_gid = $gid_option; create_homedir(0); exit( RET_OK ); } ############# ## adduser ## ############# if ($action eq "adduser") { acquire_lock(); $primary_gid=-1; my @supplemental_groups=(); log_trace( "new_uid %s", $new_uid ); log_trace( "ingroup_name %s, gid_option %s", $ingroup_name, $gid_option ); log_trace( "usergroups %s", $config{"usergroups"} ); log_trace( "users_gid %s, users_group %s", $config{"users_gid"}, $config{"users_group"} ); log_trace( "primary_gid %s, supplemental groups %s", $primary_gid, join(", ",@supplemental_groups) ); if( defined($config{"users_gid"}) && defined($config{"users_group"}) ) { log_warn ( mtx("USERS_GID and USERS_GROUP both given in configuration. This is an error.") ); log_fatal (mtx("The user `%s' was not created."),$new_name); exit( RET_CONFIG_ERROR ); } if ($config{"usergroups"} =~ /yes/i) { log_trace( "config usergroups == yes code path" ); $make_group_also = 1; if( $gid_option ) { $make_group_also = 0; $primary_gid = $gid_option; log_trace( "gid_option defined %s, make_group_also 0, primary_gid=gid_option", $gid_option ); } if( $ingroup_name ) { $make_group_also = 0; $primary_gid = getgrnam($ingroup_name); log_trace( "ingroup_name defined %s, make_group_also 0, primary_gid %s", $gid_option, $primary_gid ); } log_trace( "make_group_also %s, primary_gid %s", $make_group_also, $primary_gid ); if( defined( $primary_gid) && $primary_gid == -1 && $make_group_also == 0 ) { if (defined($config{"users_gid"}) && $config{"users_gid"} != -1) { my @grgid=getgrgid($config{"users_gid"}); my $grname=$grgid[0]; log_debug( "set primary_gid to users_gid %s %s", $config{"users_gid"}, $grname); $primary_gid = $config{"users_gid"}; } elsif (defined($config{"users_gid"}) && $config{"users_gid"} == -1) { # nothing } else { my $primary_group="users"; if (defined($config{"users_group"})) { $primary_group=$config{"users_group"}; } $primary_gid=getgrnam($primary_group); log_debug( "set primary_gid to users_group %s %s", $primary_gid, $primary_group); } } else { if (defined($config{"users_gid"}) && $config{"users_gid"} != -1) { my @grgid=getgrgid($config{"users_gid"}); my $grname=$grgid[0]; log_trace( "push users_gid %s %s to supplemental_groups", $config{"users_gid"}, $grname); push(@supplemental_groups, $grname); } elsif (defined($config{"users_gid"}) && $config{"users_gid"} == -1) { # nothing } else { my $supp_group="users"; if (defined($config{"users_group"})) { $supp_group=$config{"users_group"}; } log_trace( "push %s to supplemental_groups", $supp_group ); push(@supplemental_groups, $supp_group); } } } else { log_debug( "config usergroups != yes code path" ); if( defined($ingroup_name) ) { $primary_gid=getgrnam($ingroup_name); } elsif (defined($config{"users_gid"})) { log_trace( "primary_gid = users_gid = %d", $primary_gid ); $primary_gid = $config{"users_gid"}; } else { if (defined($config{"users_group"})) { my @grgid=getgrnam($config{"users_group"}); my $grgid=$grgid[2]; log_trace( "primary_gid = users_group %s %s", $config{"users_group"}, $grgid); $primary_gid = $grgid; } else { log_trace( "primary_gid = literal 100"); $primary_gid = 100; } } if( $primary_gid == -1 ) { log_fatal( "no primary GID for user set. User not created." ); exit( RET_NO_PRIMARY_GID ); } } log_debug( "primary_gid %s, supplemental groups %s", $primary_gid, join(", ",@supplemental_groups) ); if ( defined $ingroup_name || defined $gid_option ) { $make_group_also = 0; log_trace( "set make_group_also 0, neither ingroup_name or gid_option defined" ); } check_user_group(0); $first_uid = $new_firstuid || $config{"first_uid"}; $last_uid = $new_lastuid || $config{"last_uid"}; if ($config{"usergroups"} =~ /yes/i) { $first_gid = $first_uid; $last_gid = $last_uid; } else { $first_gid = $new_firstgid || $config{"first_gid"}; $last_gid = $new_lastgid || $config{"last_gid"}; } log_trace( "first_uid %s, last_uid %s, first_gid %s, last_gid %s", $first_uid, $last_uid, $first_gid, $last_gid ); log_info (gtx("Adding user `%s' ..."),$new_name); if (!defined($new_uid)) { if ( defined $ingroup_name ) { $new_uid = &first_avail_uid( $first_uid, $last_uid, $uid_pool{$new_name}{'id'}); } else { my $first_uidgid = ($first_uid, $first_gid)[$first_uid > $first_gid]; my $last_uidgid = ($last_uid, $last_gid)[$last_uid < $last_gid]; # TODO: Check what happens when those ranges do not overlap $new_uid = &first_avail_uid_gid( $first_uidgid, $last_uidgid, $uid_pool{$new_name}{'id'}); log_trace( "uidgid=%s, from first_uidgid %s, last_uidgid %s", $new_uid, $first_uidgid, $last_uidgid); } # TODO: user can specify different UID and GID here. # idea: split handling in uid/gid, which are equally the return value of # first_avail_uid_gid. If either pool_id is defined, set uid and gid from # distinct first_avail_uid and first_avail_gid calls. log_debug( "new_uid %s selected", $new_uid); if ($new_uid == -1) { log_warn( mtx("No UID/GID pair is available in the range %d-%d (FIRST_UID - LAST_UID)."), $first_uid, $last_uid); log_fatal( mtx("The user `%s' was not created."), $new_name ); exit( RET_NO_ID_IN_RANGE ); } log_trace( "gid_option %s, ingroup_name %s", $gid_option, $ingroup_name ); if ( defined $gid_option && $gid_option == -1 && defined $ingroup_name && $ingroup_name == "") { log_warn( mtx("USERGROUPS=no, USER_GID=-1 and USERS_GROUP empty. A user needs a primary group!") ); log_fatal( mtx("The user `%s' was not created."), $new_name ); exit( RET_NO_PRIMARY_GROUP ); } elsif (defined($gid_option) && $gid_option != -1) { $ingroup_name = getgrgid($gid_option); $primary_gid = $gid_option; log_debug( "gid_option defined and not -1, ingroup_name %s, primary_gid %d", $ingroup_name, $primary_gid ); } elsif ($ingroup_name) { $primary_gid = getgrnam($ingroup_name); log_debug( "ingroup_name defined %s, primary_gid %d", $ingroup_name, $primary_gid ); } elsif ( defined( $primary_gid ) ) { $ingroup_name = getgrgid($primary_gid); log_debug( "primary_gid defined %d, ingroup_name %s", $primary_gid, $primary_gid ); } else { $ingroup_name = 'users'; $primary_gid = 100; log_debug( "ingroup_name hard users, primary_gid hard 100" ); } if ($make_group_also) { $primary_gid = $new_uid; $ingroup_name = $new_name; log_trace( "make_group_also %s, primary_gid %s, ingroup_name %s", $make_group_also, $primary_gid, $ingroup_name ); } } else { log_debug( "new_uid %s, primary_gid %s, ingroup_name %s, make_group_also %s", $new_uid, $primary_gid, $ingroup_name, $make_group_also ); if (defined($gid_option)) { $ingroup_name = getgrgid($gid_option); $primary_gid = $gid_option; log_debug( "gid_option defined %s, ingroup_name %s", $gid_option, $ingroup_name ); } elsif (defined($primary_gid) && $primary_gid != -1) { $ingroup_name = getgrgid($primary_gid); log_debug( "primary_gid defined %s, ingroup_name %s", $primary_gid, $ingroup_name ); } elsif ($ingroup_name) { $primary_gid = getgrnam($ingroup_name); log_debug( "ingroup_name defined %s, primary_gid %s", $ingroup_name, $primary_gid ); } elsif ($make_group_also) { $primary_gid=$new_uid; $ingroup_name=$new_name; log_debug( "make_group_also %s, primary_gid defined %s, ingroup_name %s", $make_group_also, $primary_gid, $ingroup_name ); } else { log_debug( "no gid_option, no primary_gid, no ingroup_name, no make_group_also" ); log_fatal( mtx("Internal error interpreting parameter combination") ); exit( RET_INTERNAL ); } } log_debug ("make_group_also %s", $make_group_also ); if ($make_group_also) { $undogroup = $new_name; my $groupadd = &which('groupadd'); if( defined( $primary_gid ) ) { log_info( mtx("Adding new group `%s' (%d) ..."), $new_name, $primary_gid); if ( ($use_extrausers) || ($config{"use_extrausers"}) ) { &systemcall($groupadd, '--extrausers', '-g', $primary_gid, $new_name); } else { &systemcall($groupadd, '-g', $primary_gid, $new_name); } } else { log_info( mtx("Adding new group `%s' (new group ID) ..."), $new_name); if ( ($use_extrausers) || ($config{"use_extrausers"}) ) { &systemcall($groupadd, '--extrausers', $new_name); } else { &systemcall($groupadd, $new_name); } $primary_gid = getgrnam($new_name); log_info( mtx("new group '%s' created with GID %d"), $new_name, $primary_gid ); } } { my @grgid=getgrgid($primary_gid); my $grname=$grgid[0]; log_info( mtx("Adding new user `%s' (%d) with group `%s (%d)' ..."), $new_name, $new_uid, $grname, $primary_gid ); } $home_dir = $special_home || $uid_pool{$new_name}{'home'} || &homedir($new_name, $ingroup_name); if( !$disabled_login ) { $shell = $special_shell || $uid_pool{$new_name}{'shell'} || $config{"dshell"}; } else { $shell = $special_shell || $uid_pool{$new_name}{'shell'} || "/usr/sbin/nologin"; } log_debug( "creating new user with home_dir %s and shell %s", $home_dir, $shell ); $undouser = $new_name; my $useradd = &which('useradd'); if ( ($use_extrausers) || ($config{"use_extrausers"}) ) { &systemcall($useradd, '--extrausers', '-d', $home_dir, '-g', $primary_gid, '-s', $shell, '-u', $new_uid, $new_name); } else { &systemcall($useradd, '-d', $home_dir, '-g', $primary_gid, '-s', $shell, '-u', $new_uid, $new_name); } create_homedir (1); # copy skeleton data # useradd without -p has left the account disabled (password string is '!') my $yesexpr = langinfo(YESEXPR()); my $noexpr = langinfo(NOEXPR()); if ($ask_passwd) { PASSWD: for (;;) { my $passwd = &which('passwd'); # do _not_ use systemcall() here, since systemcall() dies on # non-zero exit code and we need to do special handling here! system($passwd, $new_name); my $ok = $?>>8; if ($ok != 0) { my $answer; # hm, error, should we break now? log_warn( mtx("Permission denied")) if ($ok == 1); log_warn( mtx("invalid combination of options")) if ($ok == 2); log_warn( mtx("unexpected failure, nothing done")) if ($ok == 3); log_warn( mtx("unexpected failure, passwd file missing")) if ($ok == 4); log_warn( mtx("passwd file busy, try again")) if ($ok == 5); log_warn( mtx("invalid argument to option")) if ($ok == 6); # Translators: [y/N] has to be replaced by values defined in your # locale. You can see by running "locale noexpr" which regular # expression will be checked to find positive answer. PROMPT: for (;;) { print (gtx("Try again? [y/N] ")); chop ($answer=<STDIN>); last PROMPT if ($answer =~ m/$yesexpr/o); last PASSWD if ($answer =~ m/$noexpr/o); last PASSWD if (!$answer); } } else { last; ## passwd ok } } } if (defined($new_comment)) { &ch_comment($new_comment); } elsif ($uid_pool{$new_name}{'comment'}) { &ch_comment($uid_pool{$new_name}{'comment'}); } else { my $noexpr = langinfo(NOEXPR()); my $yesexpr = langinfo(YESEXPR()); CHFN: for (;;) { my $chfn = &which('chfn'); if ( ($use_extrausers) || ($config{"use_extrausers"}) ) { &systemcall($chfn, '--extrausers', $new_name); } else { &systemcall($chfn, $new_name); } # Translators: [y/N] has to be replaced by values defined in your # locale. You can see by running "locale yesexpr" which regular # expression will be checked to find positive answer. PROMPT: for (;;) { print (gtx("Is the information correct? [Y/n] ")); chop (my $answer=<STDIN>); last PROMPT if ($answer =~ m/$noexpr/o); last CHFN if ($answer =~ m/$yesexpr/o); last CHFN if (!$answer); } } } if ( ( $add_extra_groups || $config{"add_extra_groups"} ) && defined($config{"extra_groups"}) ) { log_debug( "add extra_groups from config (%s) to supplemental_groups", $config{"extra_groups"} ); push (@supplemental_groups, split(/\s+/,$config{"extra_groups"})); } if ( @supplemental_groups ) { log_info( mtx("Adding new user `%s' to supplemental / extra groups `%s' ..."), $new_name, join(", ", @supplemental_groups) ); foreach my $newgrp ( @supplemental_groups ) { log_trace( "newgrp %s", $newgrp ); if (!defined getgrnam($newgrp)) { log_warn( mtx("The group `%s' does not exist."), $newgrp); next; } if (&user_is_member($new_name, $newgrp)) { log_info( mtx("The user `%s' is already a member of `%s'."), $new_name,$newgrp ); next; } log_info( mtx("Adding user `%s' to group `%s' ..."), $new_name, $newgrp ); my $gpasswd = &which('gpasswd'); if ( ($use_extrausers) || ($config{"use_extrausers"}) ) { &systemcall($gpasswd, '--extrausers', '-M', join(',', get_group_members($newgrp), $new_name), $newgrp); } else { &systemcall($gpasswd, '-M', join(',', get_group_members($newgrp), $new_name), $newgrp); } } } if ($config{"quotauser"}) { log_info( mtx("Setting quota for user `%s' to values of user `%s' ..."), $new_name, $config{quotauser} ); my $edquota = &which('edquota'); &systemcall($edquota, '-p', $config{quotauser}, $new_name); } &systemcall('/usr/local/sbin/adduser.local', $new_name, $new_uid, $primary_gid, $home_dir) if (-x "/usr/local/sbin/adduser.local"); release_lock(0); exit( RET_OK ); } # # we never go here # # calculate home directory sub homedir { my $dir = $config{"dhome"}; $dir .= '/' . $_[1] if ($config{"grouphomes"} =~ /yes/i); $dir .= '/' . substr($_[0],0,1) if ($config{"letterhomes"} =~ /yes/i); $dir .= '/' . $_[0]; return $dir; } # create_homedir -- create the homedirectory # parameter # 1: $copy_skeleton: # if 0 -> do not copy the skeleton data # if 1 -> copy the files in /etc/skel to the newly created home directory # return values: # none sub create_homedir { my ($copy_skeleton) = @_; if ($home_dir =~ /^\/+nonexistent(\/|$)/) { log_info( mtx("Not creating `%s'."), $home_dir ); } elsif ($no_create_home) { log_info( mtx("Not creating home directory `%s'."), $home_dir ); } elsif (-e $home_dir) { log_warn( mtx("The home directory `%s' already exists. Not touching this directory."), $home_dir ); my @homedir_stat = stat($home_dir); my $home_uid = $homedir_stat[4]; my $home_gid = $homedir_stat[5]; if (($home_uid != $new_uid) || ($home_gid != $primary_gid)) { log_warn( mtx("Warning: The home directory `%s' does not belong to the user you are currently creating."), $home_dir ); } } else { log_info( mtx("Creating home directory `%s' ..."),$home_dir ); $undohome = $home_dir; if( !&mktree($home_dir) ) { log_err( gtx("Couldn't create home directory `%s': %s."), $home_dir, $!); &cleanup(); } if ($action eq "adduser") { # Mute the command system('sh' => ( '-c' => '"$@" >/dev/null 2>&1', '--', '/usr/sbin/zsysctl', 'userdata', 'create', $new_name, $home_dir,)); } if( !chown($new_uid, $primary_gid, $home_dir) ) { log_err("chown %s:%s %s: %s", $new_uid, $primary_gid, $home_dir, $!); &cleanup(); } $dir_mode = get_dir_mode(); if( !chmod ($dir_mode, $home_dir) ) { log_err("chmod %s %s: %s", $dir_mode, $home_dir, $!); &cleanup(); } if (defined($encrypt_home)) { printf gtx("Setting up encryption ...\n") if $verbose; &systemcall($ecryptfs_setup_private, '-b', '-u', $new_name); } if ($config{"skel"} && $copy_skeleton) { log_info( mtx("Copying files from `%s' ..."), $config{skel} ); my $findpipe; if( !open($findpipe, q{-|}, "cd $config{skel}; find . -print") ) { log_err( mtx("fork for `find' failed: %s"), $!); &cleanup(); } while (<$findpipe>) { chop; next if ($_ eq "."); next if ($_ =~ qr/$config{skel_ignore_regex}/ ); ©_to_dir($config{"skel"}, $_, $home_dir, $new_uid, $primary_gid, ($config{"setgid_home"} =~ /yes/i)); } close ($findpipe); } if (defined($encrypt_home)) { &systemcall("/bin/umount", $home_dir); } } } # mktree: create a directory and all parent directories # we do not care about the rights and so on # parameters: # tree: the path # return values: # none sub mktree { my($tree) = @_; my($done, @path); my $default_dir_mode = oct(755); $tree =~ s:^/*(.*)/*$:$1:; # chop off leading & trailing slashes @path = split(/\//, $tree); $done = ""; while (@path) { $done .= '/' . shift(@path); -d $done || mkdir($done, $default_dir_mode) || return 0; } return 1; } # existing_user_ok: check if there is already a user present # on the system which satisfies the requirements # parameter: # new_name: the name of the user to check # new_uid : the UID of the user # return values: # 0 if the the user does not exist # 1 if the user already exists with the specified uid # (or $new_uid was not specified) # 2 if the user already exists, but $new_uid does not match its uid sub existing_user_ok { my($new_name,$new_uid) = @_; my ($dummy1,$dummy2,$uid); if (($dummy1,$dummy2,$uid) = getpwnam($new_name)) { if( defined($new_uid) && $uid == $new_uid ) { return 1; } if (! defined($new_uid)) { return 1; } # TODO: do we really need this code? Range check should not be performed here # also, we might be checking a normal user as well here if( $uid >= $config{"first_system_uid"} && $uid <= $config{"last_system_uid" } ) { return 2; } } else { return 0; } } # existing_group_ok: check if there is already a group which satiesfies the requirements # parameter: # new_name: the name of the group # new_gid : the GID of the group # return values: # 0 if the group does not exist # 1 if the group already exists with the specified gid # (or $gid_option was not specified) # 2 if the group already exists, but $gid_option does not match its gid # 3 if the group already exists inside the system range sub existing_group_ok { my($new_name,$new_gid) = @_; my ($dummy1,$dummy2,$gid); if (($dummy1,$dummy2,$gid) = getgrnam($new_name)) { # TODO: is this check required? There should not be any # gid outside of our allowed range anyways ... # also, we might be checking a normal user as well here if( $gid >= $config{"first_system_gid"} && $gid <= $config{"last_system_gid" } ) { return 3; } if (! defined($new_gid)) { return 1; } if ($gid == $new_gid) { return 1; } else { return 2; } } else { return 0; } } # check_user_group: ??? # parameters: # system: 0 if the user is not a system user, 1 otherwise # return values: # # todo: not sure whether global variables apply fine here. sub check_user_group { my ($system) = @_; log_debug( "check_user_group %s called, make_group_also %s", $system, $make_group_also ); if( !$system || !existing_user_ok($new_name, $new_uid) ) { if( defined getpwnam($new_name) ) { if( $system ) { log_fatal( mtx("The user `%s' already exists, and is not a system user."), $new_name); exit( RET_WRONG_OBJECT_PROPERTIES ); } else { log_fatal( mtx("The user `%s' already exists."), $new_name); exit( RET_OBJECT_EXISTS ); } } if (defined($new_uid) && getpwuid($new_uid)) { log_fatal( mtx("The UID %d is already in use."), $new_uid); exit( RET_ID_IN_USE ); } } if ($make_group_also) { log_trace( "make_group_also 1, new_name %s, new_uid %s", $new_name, $new_uid ); if( !$system || !existing_group_ok($new_name, $new_uid) ) { if (defined getgrnam($new_name)) { log_fatal( mtx("The group `%s' already exists."),$new_name ); exit( RET_OBJECT_EXISTS ); } if (defined($new_uid) && defined(getgrgid($new_uid))) { log_fatal( mtx("The GID %d is already in use."),$new_uid ); exit( RET_ID_IN_USE ); } } } else { if ($ingroup_name && !defined(getgrnam($ingroup_name))) { log_fatal( mtx("The group `%s' does not exist."), $ingroup_name); exit( RET_OBJECT_DOES_NOT_EXIST ); } if (defined($gid_option) && !defined(getgrgid($gid_option))) { log_fatal( mtx("No group with GID %d found."), $gid_option); exit( RET_OBJECT_DOES_NOT_EXIST ); } } log_debug( "return from check_user_group" ); } # copy_to_dir : # parameters: # fromdir # file # todir # newi # newg # sgiddir # return values: # none sub copy_to_dir { my($fromdir, $file, $todir, $newu, $newg, $sgiddir) = @_; if (-l "$fromdir/$file") { my $target; if( !($target = readlink("$fromdir/$file")) ) { log_err( "readlink: %s", $! ); &cleanup(); } my $curgid="$)"; my $curuid="$>"; my $error=""; $)="$newg"; $>="$newu"; symlink("$target", "$todir/$file") or $error="$!"; $>="$curuid"; $)="$curgid"; if( "$error" ne "" ) { log_err( "symlink: %s", $!); &cleanup(); } return; } elsif (-f "$fromdir/$file") { my $filefh; my $newfilefh; if( !open ($filefh, q{<}, "$fromdir/$file") ) { log_err( "open %s/%s: %s", $fromdir, $file , $!); &cleanup(); } if( !open ($newfilefh, q{>}, "$todir/$file") ) { log_err( "open >%s/%s: %s", $todir, $file, $!); &cleanup(); } if( !print $newfilefh (<$filefh>) ) { log_err( "print %s/%s: %s", $todir, $file, $!); &cleanup(); } close($filefh); if( !close($newfilefh) ) { log_err( "close %s/%s: %s", $todir, $file, $!); &cleanup(); } } elsif (-d "$fromdir/$file") { if( !mkdir("$todir/$file", 700) ) { log_err( "mkdir: %s/%s: %s", $todir, $file, $!); &cleanup(); } } else { log_err( mtx("%s/%s is neither a dir, file, nor a symlink."), $fromdir, $file ); &cleanup(); } if( !chown($newu, $newg, "$todir/$file") ) { log_err( "chown %s:%s %s/%s: %s", $newu, $newg, $todir, $file, $! ); &cleanup(); } $perm = (stat("$fromdir/$file"))[2] & oct(7777); if (-d "$fromdir/$file" && ($perm & oct(10)) && $sgiddir) { $perm |= oct(2000); } if( !chmod($perm, "$todir/$file") ) { log_err( "chmod %s/%s: %s", $todir, $file, $!); &cleanup(); } } # checkname: perform some sanity checks # parameters: # name: the name to check # return values: # none (exits on error) sub checkname { my ($name) = @_; my $ieee_regex = '^[_.A-Za-z0-9][-\@_.A-Za-z0-9]*\$?$'; my $min_regex = qr{^[^-+~:,\s/][^:,\s/]*$}; my $name_regex_var = $found_sys_opt ? 'SYS_NAME_REGEX' : 'NAME_REGEX'; my $name_regex = $config{lc $name_regex_var}; if ($name =~ /^[\d]+$/) { # this check cannot be turned off log_err( mtx("To avoid ambiguity with numerical UIDs, usernames which consist of only digits are not allowed.") ); exit( RET_INVALID_CHARS_IN_NAME ); } if (length $name > 32) { # this check cannot be turned off log_err( mtx("Usernames must be no more than 32 bytes in length; note that if you are using Unicode characters, the character limit will be less than 32.") ); exit( RET_INVALID_CHARS_IN_NAME ); } if ($name !~ $min_regex) { # this check cannot be turned off log_err( mtx("To avoid problems, the username must not start with a dash, plus sign, or tilde, and it must not contain any of the following: colon, comma, slash, or any whitespace characters including spaces, tabs, and newlines.") ); exit( RET_INVALID_CHARS_IN_NAME ); } return if ($name =~ qr/$name_regex/); if ($name !~ $ieee_regex && $name_check_level < 2) { log_err( mtx("To avoid problems, the username should consist only of letters, digits, underscores, periods, at signs and dashes, and not start with a dash (as defined by IEEE Std 1003.1-2001). For compatibility with Samba machine accounts, \$ is also supported at the end of the username. (Use the `--allow-all-names' option to bypass this restriction.)") ); exit( RET_INVALID_CHARS_IN_NAME ); } if ($name_check_level) { log_info( mtx("Allowing use of questionable username.") ); } else { log_err( mtx("Please enter a username matching the regular expression configured via the %s configuration variable. Use the `--allow-bad-names' option to relax this check or reconfigure %s in configuration."), $name_regex_var, $name_regex_var ); exit( RET_INVALID_CHARS_IN_NAME ); } } # first_avail_uid: return the first available uid in given range # parameters: # min, max: the range # pool_id: user id suggested from pool # return values: # -1 if no free uid is available # otherwise the choosen uid sub first_avail_uid { my ($min, $max, $pool_id) = @_; if (defined ($pool_id)) { return $pool_id if (!defined(getpwuid($pool_id))); return -1; } log_info( mtx("Selecting UID from range %d to %d ...\n"),$min,$max); my $t = $min; while ($t <= $max) { return $t if (!defined(getpwuid($t))); $t++; } return -1; # nothing available } # first_avail_gid: return the first available gid in given range # parameters: # min, max: the range # pool_id: group id suggested from pool # return values: # -1 if no free gid is available # otherwise the choosen gid sub first_avail_gid { my ($min, $max, $pool_id) = @_; if (defined ($pool_id)) { return $pool_id if (!defined(getgrgid($pool_id))); return -1; } log_info( mtx("Selecting GID from range %d to %d ..."),$min,$max); my $t = $min; while ($t <= $max) { return $t if (!defined(getgrgid($t))); $t++; } return -1; # nothing available } # first_avail_uid_gid: return the first available id in given range # that is both available as uid and gid # parameters: # min, max: the range # pool_id: user id suggested from pool # return values: # -1 if no free id is available # otherwise the choosen id sub first_avail_uid_gid { my ($min, $max, $pool_id) = @_; if (defined ($pool_id)) { return $pool_id if (!defined(getgrgid($pool_id))); return -1; } log_info( mtx("Selecting UID/GID from range %d to %d ..."), $min, $max ); my $t = $min; while ($t <= $max) { return $t if (!defined(getgrgid($t)) && !defined(getpwuid($t))); $t++; } return -1; # nothing available } sub ch_comment { my $chfn = &which('chfn'); my $comment = shift; if($comment =~ /,/) { my($comment_name,$comment_room,$comment_work,$comment_home,$comment_other) = split(/,/,$comment); if ( ($use_extrausers) || ($config{"use_extrausers"}) ) { &systemcall($chfn, '--extrausers', '-f', $comment_name, '-r', $comment_room, $new_name); &systemcall($chfn,'--extrausers','-w',$comment_work,$new_name) if(defined($comment_work)); &systemcall($chfn,'--extrausers','-h',$comment_home,$new_name) if(defined($comment_home)); &systemcall($chfn,'--extrausers','-o',$comment_other,$new_name) if(defined($comment_other)); } else { &systemcall($chfn, '-f', $comment_name, '-r', $comment_room, $new_name); &systemcall($chfn,'-w',$comment_work,$new_name) if(defined($comment_work)); &systemcall($chfn,'-h',$comment_home,$new_name) if(defined($comment_home)); &systemcall($chfn,'-o',$comment_other,$new_name) if(defined($comment_other)); } } else { if ( ($use_extrausers) || ($config{"use_extrausers"}) ) { &systemcall($chfn, '--extrausers', '-f', $comment, $new_name); } else { &systemcall($chfn, '-f', $comment, $new_name); } } } # user is member of group? sub user_is_member { my($user, $group) = @_; for (split(/ /, (getgrnam($group))[3])) { return 1 if ($user eq $_); } return 0; } sub cleanup { if ($undohome) { log_info( mtx("Removing directory `%s' ..."), $undohome); &systemcall('rm', '-rf', $undohome); } if ($undouser) { log_info( mtx("Removing user `%s' ..."), $undouser); &systemcall('userdel', $undouser); } if ($undogroup) { log_info( mtx("Removing group `%s' ..."), $undogroup); &systemcall('groupdel', $undogroup); } exit( RET_ADDUSER_ABORTED ); } sub handler { my($sig) = @_; # Translators: the variable %s is INT, QUIT, or HUP. # Please do not insert a space character between SIG and %s. log_err( mtx( "Caught a SIG%s.", $sig ) ); &cleanup(); } sub version { printf( gtx("adduser version %s\n\n"), $version ); print( gtx("Adds a user or group to the system. For detailed copyright information, please refer to /usr/share/doc/adduser/copyright. \n") ); print( gtx( "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License, /usr/share/common-licenses/GPL, for more details. ") ); } sub usage { printf( gtx( "adduser [--uid id] [--firstuid id] [--lastuid id] [--gid id] [--firstgid id] [--lastgid id] [--ingroup group] [--add-extra-groups] [--encrypt-home] [--shell shell] [--comment comment] [--home dir] [--no-create-home] [--allow-all-names] [--allow-bad-names] [--disabled-password] [--disabled-login] [--conf file] [--extrausers] [--quiet] [--verbose] [--debug] user Add a normal user adduser --system [--uid id] [--group] [--ingroup group] [--gid id] [--shell shell] [--comment comment] [--home dir] [--no-create-home] [--conf file] [--extrausers] [--quiet] [--verbose] [--debug] user Add a system user adduser --group [--gid ID] [--firstgid id] [--lastgid id] [--conf file] [--extrausers] [--quiet] [--verbose] [--debug] group addgroup [--gid ID] [--firstgid id] [--lastgid id] [--conf file] [--extrausers] [--quiet] [--verbose] [--debug] group Add a user group addgroup --system [--gid id] [--conf file] [--extrausers] [--quiet] [--verbose] [--debug] group Add a system group adduser [--extrausers] USER GROUP Add an existing user to an existing group\n") ); } sub usage_error { &usage; exit( RET_INVALID_CALL ); } # get_dir_mode: return the appropriate permissions mode for a home directory # parameters: # none # return value: # a valid octal mode sub get_dir_mode { my $setgid = $config{"setgid_home"} =~ /yes/i; my $mode = $found_sys_opt ? $config{"sys_dir_mode"} : $config{"dir_mode"}; if(!defined($mode) || ! ($mode =~ /[0-7]{3}/ || $mode =~ /[0-7]{4}/)) { $mode = ($found_sys_opt) ? "750" : "0750"; } if($setgid && (length($mode) == 3 || $mode =~ /^[0-1|4-5][0-7]{3}$/)) { $mode += 2000; } return oct($mode); } # Local Variables: # mode:cperl # cperl-indent-level:4 # End: # vim: tabstop=4 shiftwidth=4 expandtab
Close