jump用户管理命令

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-26 07:52:51

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/*

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!