码迷,mamicode.com
首页 > 系统相关 > 详细

linux添加用户

时间:2019-07-31 22:02:00      阅读:144      评论:0      收藏:0      [点我收藏+]

标签:root   long   需要   nop   bash   跳板   sudo   who   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

#为用户增加sudo权限

echo "wuhan  ALL=(ALL) NOPASSWD: ALL " >>/etc/sudoers

visudo -c

 

# 编辑sudoers文件要用,不然readonly:

sudoedit  /etc/sudoers

#需要限制权限,可在末尾添加修改下面

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

 

linux添加用户

标签:root   long   需要   nop   bash   跳板   sudo   who   user   

原文地址:https://www.cnblogs.com/hongfeng2019/p/11279121.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!