Python 5th Class (user group permissions for Linux systems)

Source: Internet
Author: User

Job One:

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

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

3) View the last line of the user information profile

4) Set the password "123" for the Natasha user

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

6) Lock The Natasha user account

7) Unlock The Natasha user account

8) New group Police,gid to 999

9) View the last line of the group configuration file

Add Natasha users to the Police group

One) modify The group name of the police group to Jingcha

Delete Natasha users, with home directories and mailboxes deleted together

Delete Jingcha Group

Useradd-u 1000-g 555-c "Master"-d/home/natasha

Tail-1/etc/passwd

Echo 123 | passwd--stdin Natasha

Tail-1/etc/shadow

USERMOD-L Natasha

Usermod-u Natasha

GROUPADD-G 999 Police

Tail-1/etc/group

Usermod-g Police Natasha

Groupmod-n Jingcha

USERDEL-R Natasha

Groupdel Jingcha

Job Two:

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

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

3) Set permissions for file file1 so that other users can write to this 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.

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.

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.

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

9) Add write permissions to this directory for other users

Mkdir/usr/test

Cd/usr/test

Touch file1

Chmod o=w File1

In this case, a new group of users is created to write to the file (account creation title is shown)

Echo "...." >> file1 (write operation)

Read and Execute operations are available

Cat file1 (Read)

Cd file1 (execution)

Perform permission tests

Chmod g-r File1

Switch between different users for permission testing (test method as described above)

Chmod 755 File1

Permission test

Chmod 444 File1

Test permissions

Cd..

ll-d Test

Chmod o+w Test

Job Three:

Create a new user by manipulating the file Alex

Mkdir/home/alex

vim/etc/passwd

Vim/etc/shadow

vim/etc/group/

Vim/etc/gshadow

\cp-r Etc/skel/. [!.] /home/alex

Chown-r Alex:alex/home/alex

Touch/var/spool/mail/alex

Chown Alex:mail/var/spool/mail/alex

Id Alex can query the user for more information

Job Four:

1) Create a new directory/test/dir, the owner is Tom, the array for the Group1,/test directory has permission of 777

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)

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) Create a new file in Dir directory Tom.txt, the owner is Tom, the group is the Group1,/test directory permissions 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 and modify Tom.txt group1 permissions to match the verification 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)

Mkdir/test/dir

This assumes that the Tom user has created the completed

Chown Tom:group1/test/dir

Useradd Jack.

Su-jack

Ll-d/test/dir

Su-tom

Ll-tom

Modify the permissions by chmod implementation of the specific operation by means of a digital representation to add and subtract

Touch/test/dir/tom.txt

Chown Tom:group1/test/dir/tom.txt

Chmod 777/test

Useradd Rose

Su-rose

Cat command, echo "..." >>/test/dir/tom.txt,cd/test/dir/tom.txt for permission Testing

then use the chmod to use the digital representation method for permission modification, log in to different accounts for read and write execution operation test.

Su-root

The test method is the same.

2017-05-24

19:40:08

Python 5th Class (user group permissions for Linux systems)

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.