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 
[root@centos7 ~]$ vim /etc/hosts #  Under the edit hosts File,   to add hostname
[root@centos7 ~]$ cat /etc/hosts #  check localhost localhost.localdomain localhost4 localhost4.localdomain4 hadoop001
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

Password-free login

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


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: