Changing host names and switching between User and root users in Ubuntu

Source: Internet
Author: User

 

1. Host name displayed on Ubuntu

Terminal window, you can see the host name in the command prompt, the host name is usually located after the "@" symbol;

Enter the hostname or uname-n command in the terminal window.

  

2. How do I modify the Ubuntu host name?

By default, Ubuntu login users are user-defined users rather than default root users. You must be the root user to modify the system file.

  

1) the method for modifying the host name in the root permission environment is as follows:

Enter gedit/etc/hostname in the terminal, as shown in. Modify and save the host name in the pop-up text editor.

      

2) There are two methods to modify the host name without the root permission:

Switch from a common user to the root user terminal and enter the sudo su command.Then, use the method described above.

Enter the command in the terminal: sudo gedit/etc/hostname

Note: The host name must be restarted after modification.

3 switch from User to root User

Command

Command

4 switch from Root to User

Command

5 difference between su and sudo

After entering the su command on the terminal, the system prompts you to enter the password, which is the password of the root user. Su directly switches the current user to the root user.

Sudo executes commands on the terminal as other users.

6. Set the root user password

Note: After setting the root password, you can still use sudo su to switch to the root user.

7. Disable and enable root users

8. FAQs

1. When you use the su command to switch users, the system prompts that no user * password is displayed. As shown in

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.