码迷,mamicode.com
首页 > 其他好文 > 详细

Ubuntu user switch

时间:2014-09-20 23:51:19      阅读:325      评论:0      收藏:0      [点我收藏+]

标签:io   for   log   on   c   amp   ad   new   r   

To list all users you can use:

cut -d: -f1 /etc/passwd

To add a new user you can use:

sudo adduser new_username


To remove/delete a user, first you can use:

sudo userdel username

Then you may want to delete the home directory for the deleted user account :

sudo rm -r /home/username

(Please use with caution the above command!)

To modify the username of a user:

usermod -l new_username old_username

To change the password for a user:

sudo passwd username

To change the shell for a user:

sudo chsh username

To change the details for a user (for example real name):

sudo chfn username


$ whoami user1 $ su - user2 Password: $ whoami user2 $ exit logout

Ubuntu user switch

标签:io   for   log   on   c   amp   ad   new   r   

原文地址:http://www.cnblogs.com/yangzhang/p/3983935.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!