因为一般不直接用root用户操作,添加用户并且授权、免密登录就是一套常规操作了。 注:环境为centos7.8,操作的初始角色root 用户创建和授权 创建用户 adduser username 设置密码 passwd username vim /etc/sudoers 进入文件编辑器,root用户wq!保存即可 ## Allow root to run any commands anywhere root ALL=(ALL) ALL #已有行 ## 增加一行 username ALL=(ALL) ALL 客户端键入 ssh-keygen 一路回车 服务端切换用户,创建文件 $ su username