Linux Permissions command

Source: Internet
Author: User

Tag: User password indicates dir groupadd lock useradd Ash bash the

1 The new user natasha,uid is 1000,gid to 555 and the note information is "master"
  Groupadd-g 555 Natasha
Useradd-u 1000-g 555-c "Master" Natasha
2. Modify the Natasha user's home directory to/natasha'
usermod-d Home/natasha Natasha
3 . View the last line of the user information profile
  Tail-1/etc/passwd
Natasha:x:1000:555:master:/home/natasha:/bin/bash
 4 . Set password for Natasha user "123  " 
echo "123" | passwd--stdin Natasha
5 . View the last line of the user password profile
tail-1/etc/shadow
natasha:$6$til8kmxz$ Fpfzb7egbvsmm4o7ea8o2hobr6gy9kown5xhruge4o2n2kwbe5c8g/kunhhr5kyh7j5.6bn9zfwuchzehsiw8/:17240:0:99999:7:::
6 . Lock the Natasha user account
USERMOD-L Natasha
7 . Unlock the Natasha user account
Usermod-u Natasha
8 . New group Police,gid to 1111
Groupadd-g 1111 Police
9 . View the last line of the group configuration file
  Tail-1/etc/group
police:x:1111:
Ten . Add Natasha users to the police group
Usermod-g Police Natasha

One . Modify the group name of the police group to Jingcha
  Groupadd Jingcha
Groupmod-n JINGCH Police
 12   Userdel-r Natasha 
13 delete jingcha Group
Groupdel Jingcha
14 mkdir Test && touch test/file1
15 ls-l test/file1
16 . Set permissions for file File1 so that other users can write to the file.
chmod o=w test/file1
17 ls-l test/file1
rw-r---w. 1 root root 0 March   16:22 tes T/file1
 - Remove the Read permission for the file file1 from the same group of users and view the settings results.
chmod g-r Test/file1
+ . Set permissions for file files in numeric notation, 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
Ls-l file1
-rwxr-xr-x. 1 root root 0 March 16:22 file1
 - Change the permissions of the file file1 in numeric form so that the owner can only read the file. No other user has permission. View the settings results.
chmod file1
+ . Go back to the upper directory to see the permissions for test
  Ls-ld test/
Drwxr-xr-x. 2 root root 19 March 16:22 test/
 22   chmod o=x test/
23 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
New Directory/test/dir, the owner is Tom, the array for the group1,/Test directory has permission of 777
  Mkdir-p/test/dir
Useradd Tom
Groupadd group1
Chown Tom.group1/test/dir
chmod 777/test/
 - New user jack, switch to the jack user, verify the jack User's rwx permission to the dir directory (open another terminal, and then modify the Dir directory's others permissions)
  

- . 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)
  

- . Switch to Tom User, verify that Tom user rwx permissions to dir directory (open another terminal, and then modify the user permissions of the dir directory)
  in the dir directory, create a new file Tom.txt, the owner is Tom, the group isthe group1,/test directory permissions of 777
in 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)
- 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 Tom.txt group1 permissions to match the verification process)
Switch to Tom User, verify Tom User's rwx permission to Tom.txt (open another terminal, modify Tom.txt user permissions to match the verification process)

Linux Permissions command

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.