Hitchhiker's Guide to Openbsd


- What is the best way to add and delete users?


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

10.9 - What is the best way to add and delete users?
OpenBSD provides two commands for easily adding users to the system: 

adduser(8)
 

user(8)
You can also add users by hand, using 
vipw(8)
, but this is more difficult for most operations. 
http://www.openbsd.org/faq/faq10.html (8 of 32)9/4/2011 10:02:15 AM


10 - System Management
The easiest way to add a user in OpenBSD is to use the 
adduser(8)
script. You can configure adduser(8) 
by editing /etc/adduser.conf. adduser(8) allows for consistency checks on /etc/passwd/etc/group, and 
shell databases. It will create the entries and $HOME directories for you. It can even send a message to the 
user welcoming them. Here is an example user, testuser, being added to a system. He/she will be given 
the $HOME directory /home/testuser, made a member of the group guest, and given the shell /bin/ksh
adduser
Use option ``-silent'' if you don't want to see all warnings 
and questions.
Reading /etc/shells
Check /etc/master.passwd
Check /etc/group
Ok, let's go.
Don't worry about mistakes. There will be a chance later to 
correct any input.
Enter username []: testuser
Enter full name []: Test FAQ User
Enter shell csh ksh nologin sh [ksh]: ksh
Uid [1002]: Enter
Login group testuser [testuser]: guest
Login group is ``guest''. Invite testuser into other groups: 
guest no 
[no]: no
Login class authpf daemon default staff [default]: Enter
Enter password []: Type password, then Enter
Enter password again []: Type password, then Enter
Name: testuser
Password: ****
Fullname: Test FAQ User
Uid: 1002
Gid: 31 (guest)
Groups: guest
Login Class: default
HOME: /home/testuser
Shell: /bin/ksh
OK? (y/n) [y]: y
Added user ``testuser''
Copy files from /etc/skel to /home/testuser
Add another user? (y/n) [y]: n
http://www.openbsd.org/faq/faq10.html (9 of 32)9/4/2011 10:02:15 AM


10 - System Management
Goodbye!
To delete users you should use the 
rmuser(8)
 utility. This will remove all existence of a user. It will 
remove any 
crontab(1)
 entries, their $HOME dir (if it is owned by the user), and their mail. Of course it 
will also remove their /etc/passwd and /etc/group entries. Next is an example of removing the user that 
was added above. Notice you are prompted for the name, and whether or not to remove the user's home 
directory. 
rmuser
Enter login name for user to remove: testuser
Matching password entry:
testuser:$2a$07$ZWnBOsbqMJ.
ducQBfsTKUe3PL97Ve1AHWJ0A4uLamniLNXLeYrEie:1002
:31::0:0:Test FAQ User:/home/testuser:/bin/ksh
Is this the entry you wish to remove? y
Remove user's home directory (/home/testuser)? y
Updating password file, updating databases, done.
Updating group file: done.
Removing user's home directory (/home/testuser): done.

Download 1.27 Mb.

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




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