Linux - Create and Delete User + Change Permission

As a root/admin user, manage other user account and accessing permision.

Create a new user account

  • Add a new user called test
1
$ sudo adduser test
  • Type and retype password of the new user

  • Force the new user to change her password after first logon (expire the current one)

1
$ sudo passwd -e test

Delete an existing user account

  • Use the userdel command as follows:
1
$ sudo userdel test
  • To remove home directory and mail spool too, enter:
1
$ sudo userdel -r test

https://www.cyberciti.biz/faq/create-a-user-account-on-ubuntu-linux/

Create Working Directory for New User (in /mnt)

Remark: There are two harddisks mounted to the department sever. We need divide the users into different disks and balance the space usage. Take /mnt/disk1 as example,

  • Create new directory, named by user
1
$ sudo mkdir /mnt/disk1/test
  • Change the ownership of the directory
1
2
3
$ sudo chown -R [username] [user directory]

$ sudo chown -R test /mnt/disk1/test

Change Permission

  • Only the owner of the directory can read/write/excute it
1
$ sudo chmod -R 700 /mnt/disk1/test

https://blog.csdn.net/u013197629/article/details/73608613

https://stackoverflow.com/questions/3740152/how-do-i-change-permissions-for-a-folder-and-its-subfolders-files


Linux - Create and Delete User + Change Permission
http://arwenzhou.github.io/2022/11/29/Linux-manage-user/
Author
Arwen
Posted on
November 29, 2022
Licensed under