Linux basic problem
Job One:
1) New user natasha,uid is 1000,gid to 555, note information is "master"
Useradd Natasha
Groupmod-g 555 Natasha
usermod-u 1000-c Master Natasha
2) Modify Natasha user's home directory for/natasha
usermod-d/home/natasha Natasha
3) View the last line of the user Information profile
tail-1/etc/passwd
4) Set the password "123" for Natasha users
passwd 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 to 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 natasha-a-G police
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
13) Delete Jingcha Group
Groupdel Jingcha
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
ll-l file name
3) Set permissions for file File1 so that other users can write to this file.
chmod o=w/test/file1
4) View Settings results
ll-l/test/file1
5) Remove the Read permission from the same group of users to the file File1 and view the setting results.
chmod g-r/test/file1 ll-l/test/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/test/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 400/test/file1
8) Go back to the upper directory to see the test permissions
CD: ll-l/test
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
Echo ' Alex:x:1004:1004:master:/home/alex:/bin/bash ' >>/etc/passwd
Echo ' alex:!! : 17310:0:99999:7::: ' >>/etc/shadow
Echo ' alex:x:666: ' >>group
Echo ' alex:!:: ' >>/etc/gshadow
Touch/var/spool/mail/alex
uid=1004 (Alex) gid=1004 groups=1004
Job Four:
1) Create a new directory/test/dir, the owner is Tom, the array is the Group1,/test directory permission is 777
mkdir-p/test/dir
chown-r 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 .
Su-jack
[email protected] test]$ ll-d dir
drwxr-xr-x. 2 root root 6 August 13:11 dir
[email protected] test]$ Touch Dir1
Touch: Unable to create "Dir1": Insufficient permissions
[[email protected] ~]# chmod o+w/test #注意是给/test directory plus w readable permissions, if added to the/test/dir directory, Jack users will still not have permission to create
[email protected] test]$ Touch Dir1
You can try changing the O=R,O=W,O=X,O=WX, change the permissions #在root用户下给权限
3) add Jack to the Group1 group, verify the Jack User's rwx permissions to the dir directory (open another terminal, and then modify the group permissions of the Dir directory)
Span style= "font-size:14pt" >usermod-a group1-g Jack #验证和上题一样, just o change to G
su Tom
#此题和上两题一样, just change o to u, give permission
touch/test/dir/ Tom.txt
chown tom:group1/test/dir/tom.txt
chmod 777/test
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)
useradd Rose
su rose
#此题同2, 3, 4
Linux Basics (2)