Linux modifies hostname with password free login methods

  • 2020-12-07 04:35:06
  • OfStack

Modify hostname


[root@centos7 ~]$ hostnamectl set-hostname hadoop001 #  Using this command takes effect immediately and the restart takes effect 
[root@centos7 ~]$ hostname #  Look at the 
hadoop001
[root@centos7 ~]$ vim /etc/hosts #  Under the edit hosts File,   to 127.0.0.1 add hostname
[root@centos7 ~]$ cat /etc/hosts #  check 
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 hadoop001
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

Password-free login


scp id_rsa.pub lau@192.168.1.108:/home/lau/.ssh/pub_key
# The logged in user 
cd ~/.ssh/
cat pub_key >> authorized_keys
chmod 600 /home/lau/.ssh/authorized_keys

conclusion

Above is the site to you Linux modification hostname and password-free login method, I hope to help you, if you have any questions welcome to leave a message, this site will promptly reply you!


Related articles: