Hitchhiker's Guide to Openbsd


Download 1.27 Mb.
Pdf ko'rish
bet149/258
Sana04.04.2023
Hajmi1.27 Mb.
#1328980
1   ...   145   146   147   148   149   150   151   152   ...   258
Bog'liq
obsd-faq49

Adding users via user(8)
These tools are less interactive than the 
adduser(8)
 command, which makes them easier to use in scripts. 
The full set of tools is: 

group(8)
 

groupadd(8)
 

groupdel(8)

groupinfo(8)

groupmod(8)
 

user(8)

useradd(8)
 

userdel(8)

userinfo(8)

usermod(8)
 
Actually adding users
http://www.openbsd.org/faq/faq10.html (10 of 32)9/4/2011 10:02:15 AM


10 - System Management
The command /usr/sbin/user is just a frontend to the rest of the /usr/sbin/user* commands. Therefore, the 
following commands can be added by using user add or useradd, which form you chose doesn't change 
the results at all. Remember, since user(8) is not interactive, the easiest way to add users is with adduser
(8). 
useradd(8) is less daunting to use if you know the default settings beforehand. These settings are located in 
usermgmt.conf(5)
and can be viewed by doing: 
user add -D
group users
base_dir /home
skel_dir /etc/skel
shell /bin/csh
inactive 0
expire Null (unset)
range 1000..60000
These defaults will be used unless you specify alternatives with the command line options. For example, 
we want the user to be added to the group guest, not users. One more little hurdle with adding users, is 
that passwords must be specified on the command line. Importantly, the passwords must be encrypted, so 
you need to use the 
encrypt(1)
utility. For example: OpenBSD's passwords by default use the Blowfish 
algorithm for 6 rounds. Here is an example to create an encrypted password to give to useradd(8). 
encrypt -p -b 6
Enter string:
$2a$06$YOdOZM3.4m6MObBXjeZtBOWArqC2.uRJZXUkOghbieIvSWXVJRzlq
Now that we have an encrypted password, we are ready to add the user. We will add the same user with 
the same specifications as the user we added 
above
, via adduser(8). 
user add -p '$2a$06$YOdOZM3.4m6MObBXjeZtBOWArqC2.

Download 1.27 Mb.

Do'stlaringiz bilan baham:
1   ...   145   146   147   148   149   150   151   152   ...   258




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling