ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
手动拷贝id_rsa.pub的内容到其他机器
#跳板机新建user并拷贝公钥:
useradd leixiaolong #install home Dir auto
cd /home/leixiaolong
mkdir .ssh
cd .ssh
touch authorized_keys
chmod 600 authorized_keys
chown -R leixiaolong: leixiaolong ../.ssh
#Jumpserver系统用户sudo -i权限其实是写在/etc/sudoers文件里
sudoedit /etc/sudoers
1/ 可以sudo的配置
feng.feng ALL=(ALL) NOPASSWD: /bin/whoami,/bin/su,/bin/bash,!/bin/tcsh,!/usr/bin/passwd,!/usr/bin/passwd root,!/bin/vim /etc/sudoers,!/usr/bin/vim /etc/sudoers,!/usr/sbin/visudo,!/usr/bin/sudo -i,!/bin/bi /etc/ssh/*,!/bin/chmod 777 /etc/*,!/bin/chmod 777 *,!/bin/chmod 777,!/bin/chmod -R 777 *,!/bin/rm /*,!/bin/rm /,!/bin/rm -rf /,!/bin/rm -rf /*,!/bin/rm /etc,!/bin/rm -r /etc,!/bin/rm -rf /etc,!/bin/rm /etc/*,!/bin/rm -r /etc/*,!/bin/rm -rf /etc/*,!/bin/rm /root,!/bin/rm -r /root,!/bin/rm -rf /root,!/bin/rm /root/*,!/bin/rm -r /root/*,!/bin/rm -rf /root/*,!/bin/rm /bin,!/bin/rm -r /bin,!/bin/rm -rf /bin,!/bin/rm /bin/*,!/bin/rm -r /bin/*,!/bin/rm -rf /bin/*
2/ 不可以sudo的配置
feng.feng ALL=(ALL) NOPASSWD: /bin/whoami,!/bin/tcsh,!/usr/bin/passwd,!/usr/bin/passwd root,!/bin/vim ,!/usr/bin/vim /etc/sudoers,!/usr/sbin/visudo,!/usr/bin/sudo -i,!/bin/bi /etc/ssh/*,!/bin/chmod 777 /etc/*,!/bin/chmod 777 *,!/bin/chmod 777,!/bin/chmod -R 777 *,!/bin/rm /*,!/bin/rm /,!/bin/rm -rf /,!/bin/rm -rf /*,!/bin/rm /etc,!/bin/rm -r /etc,!/bin/rm -rf /etc,!/bin/rm /etc/*,!/bin/rm -r /etc/*,!/bin/rm -rf /etc/*,!/bin/rm /root,!/bin/rm -r /root,!/bin/rm -rf /root,!/bin/rm /root/*,!/bin/rm -r /root/*,!/bin/rm -rf /root/*,!/bin/rm /bin,!/bin/rm -r /bin,!/bin/rm -rf /bin,!/bin/rm /bin/*,!/bin/rm -r /bin/*,!/bin/rm -rf /bin/*