Details of Common commands on Linux servers and Common commands on linux

Source: Internet
Author: User

Details of Common commands on Linux servers and Common commands on linux
I. User

1. useradd is used to create an account.

Useradd newname // create newnamepasswd newname // set & change the password. After entering this command, you will be prompted to enter the password

2. delete a user

userdel newname

3. Switch users

su - youruser

4. ssh remote login

ssh -l root 192.168.0.11ssh root@192.168.0.11

Specified Port:

ssh -p 12333 192.168.0.11ssh -l root -p 12333 216.230.230.114ssh -p 12333 root@216.230.230.114

5. Update the ssh logon port of the server

After logging on to the server

#sudo vi /etc/ssh/sshd_config

Change port 22 to port number.

Restart the SSH service after modification./etc/init. d/ssh restart

Ii. Group

1. Create a group

groupadd testgroup

2. modify a group

groupmod -n test2group testgroup

3. delete a group

groupdel testgroup

4. View groups

Cd/homels-l # The third column indicates the owner of the file or directory, and the fourth column indicates the group of the file or directory.

5. modify a user group

-L: Rename the user, but the name of the user's home directory in the/home directory does not change. You need to manually modify the name.
-G: Modify the group in which the user is located

 usermod -g siatstudent newname

To add a user to multiple groups at a time, use the-G parameter (uppercase G ):

usermod -G friends,happy,funny newname

Note: Be careful when using usermod, because when using the-g or-G parameter, it will remove the user from the original group and add the user to the new group. If you do not want to leave the original group and want to join a new group, you can add the-a parameter on the basis of the-G parameter. a is the abbreviation of the English append, indicating "append ". For example:

Usermod-aG happy newname // newname belongs to two groups: siatstudent and happy
Groups newname # view the group to which newname belongs

Related Article

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.