Linux Permissions Related

Source: Internet
Author: User
Tags stdin

Job One:

1) New user Natasha,uid is +, gid is 555, note information is "master"

Groupadd-g 555 Natasha

Useradd-u 1000-g 555-c ' master ' Natasha

2) Modify Natasha user's home directory for /natasha

Usermod-d/natasha/natasha

3) View the last line of the user information profile

Tail-1/etc/passwd

4) Set the password "123" for Natasha users

Echo ' 123 ' |passwd--stdin Natasha

5) View the last line of the user's password profile

Tail-1/etc/shadow

6) Lock the Natasha user account

USERMOD-L Natasha

7) unlock the Natasha user account

Usermod–u Natasha

8) New group Police,GID is 999

GROUPADD-G 999 Police

9) View the last line of the group configuration file

Tail-1/etc/group

10) Add Natasha user to Police Group

USERMOD-G 999 Natasha

11) Modify The group name of the police group to Jingcha

Groupmod-n Jingcha Police

12) Delete Natasha user, even home directory and mailbox deleted together

USERDEL-R Natasha

Rm-rf/home/natasha

Rm-rf/var/spool/mail

13) Delete Jingcha Group

Groupdel Jingchaid b

Job Two:

1) Create a directory test in the user's home directory , enter test to create an empty file file1

Mkdir/test

Touch/test/file1

2) display file information in long format, note the permissions of the file and the user and group to which it belongs

Ls-l/test/file1

3) set permissions for file File1 so that other users can write to this file.

chmod 666 File

4) View the setting results,

5) Remove the Read permission from the same group of users to the file file1 and view the setting results.

chmod g-w File1

6) Use digital notation to set permissions for file files , all readable, writable, and executable, and the owning group user and other users have only read and execute permissions. Review the setup results when the settings are complete.

chmod 755 File1

7) Change the permissions of the file File1 in digital form so that the owner can only read the file. No other user has permission. View the settings results.

chmod file1

8) go back to the upper directory to see the test permissions

9) Add write permissions to this directory for other users

chmod o=w/test

Job Three:

Create a new user by manipulating the file Alex

Tail-1/etc/passwd

Alex:x:1010:1010::/home/alex:/bin/bash

Tail-1/etc/shadow

alex:!! : 17240:0:99999:7:::

Tail-1/etc/group

ALEX:X:1010:

Tail-1/etc/gshadow

alex:!::

Mkdir/home/alex

Cp-r/etc/skel/. [!.] */home/alex/

Chown-r alex.alex/home/alex/

Touch/var/spool/mail/alex

Chown-r Alex.mail/var/spool/mail/alex

Job Four:

1) Create new directory /test/dir, owner is Tom, array is group1,/test directory has permission of 777

Mkdir-p/test/dir

Groupadd group1

Chown tom.group1/test/dir/

chmod 777/test

2) New user jack, switch to the jack user, verify the Jack user rwx permissions to the dir directory (open another terminal, and then modify the Dir directory's others permissions)

Useradd Jack.

Echo 123 | passwd--stdin Jack

Su–jack

3) Add jack to the group1 group to verify the Jack user 's rwx permissions to the dir directory (open another terminal, and then modify the group permissions of the dir directory)

4) Switch to Tom User, verify the rwx permission of Tom user to dir directory (open another terminal, modify the user permission of Dir directory in turn )

5) new file Tom.txt in dir directory , owner is Tom, group is group1,/test directory has permission of 777

6) New user rose, switch to rose user, verify the rose User 's rwx permissions to Tom.txt (open another terminal, modify tom.txt Others permissions to match the verification process)

7) Add rose to the group1 group and, under the Rose User, verify the rwx permissions of the rose user to tom.txt (open another terminal, then modify the tom.txt Group1 permissions to match the validation process)

8) Switch to Tom User, verify Tom user 's rwx permission to Tom.txt (open another terminal, modify Tom.txt user permission to cooperate with the verification process)

Linux Permissions Related

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.