In the article "How to Add/Remove FTP users and set permissions in Linux", we talked about how to add and remove users, but later, we still encountered a lot of
Problem:
1. After entering the system, the command line has only a dollar sign such as "$", and the environment variable file is already copied to the user's home directory, how to revert to the xxx@ host name: ~$
Such a format.
vim/etc/passwd
See your own user name, such as:
TEST:X: ():()::/home/test:
Add/bin/bash to the back and you'll be fine.
That
TEST:X: ():()::/home/test:/bin/bash
If the "/etc/passwd" E212:can ' t open file for writing appears, there is a problem with the permissions, and after exiting, the Chattr-i/etc/passwd is executed and can be changed.
2. Unable to use root permissions
test@iz28m0c0sk6z:~$ sudo-i
[sudo] password for test: The ' isn't in '
sudoers file. This incident would be reported.
(1) Add Write permission to the sudo file, the command is:
chmod u+w/etc/sudoers
(2) Edit sudoers file
Vim/etc/sudoers
Find this line
Root all= (All:all) all
Add below it:
XXX all= (all:all) all #这里的xxx是你的用户名
PS: Here you can sudoers add any of the following four lines.
Youuser all= (All) all
%youuser all=- all Youuser all=
%youuser All= (All) Nopasswd:all
First line: Allows the user to Youuser execute the sudo command (requires a password).
Second line: Allows users in the user group Youuser to execute sudo commands (require a password).
Third line: Allows the user to execute the sudo command youuser, and does not enter the password at execution time.
Line four: Allows the user group Youuser users to execute sudo commands and not enter the password at execution time.
(3) Revoke sudoers file Write permission, command:
chmod u-w/etc/sudoers
This allows the average user to use sudo.