linux 该用户组id,linux用户和用户组的一些基本知识

1.查看用户用户组信息,(id -un是获得当前登陆的用户名称)

[root@adx /home/wm/diad]# id -un

root

[root@adx /home/wm/diad]# id wm

uid=512(wm) gid=512(wm) groups=512(wm)

You have new mail in /var/spool/mail/root

[root@adx /home/wm/diad]# groups wm

wm : wm

[root@adx /home/wm/diad]# cat /etc/group | grep "^wm"

wm:x:512:www

2.su和su-区别

su不更改环境变量,只获取root权限。

su - 更改环境变量,切换到root并获取root环境变量和执行权限。

3.useradd使用遇到的问题解决

[root@adx /home/wm/miad]# useradd -m wn

bash: useradd: command not found

[root@adx /home/wm/miad]# adduser wn

bash: adduser: command not found

[root@adx /home/wm/miad]# su -

[root@adx ~]# useradd -m wn

[root@adx ~]# passwd wn

passwd: symbol lookup error: /usr/local/lib/libgobject-2.0.so.0: undefined symbol: g_regex_unref

[root@adx ~]# echo 'wn:123456' | chpasswd

You have new mail in /var/spool/mail/root

4.使用standard input建立用户的密码

[root@adx ~]# echo "123456" | passwd --stdin wm

5.删除用户

[root@adx ~]# userdel -r wm

6.添加sudo权限

有时候,linux下面运行sudo命令,会提示类似: xxxis not in the sudoers file.  This incident will be reported. 这里,xxx是用户名称,然后导致无法执行sudo命令,这时候,如下解决:

[wm@adx ~]$ su -

Password:

[root@adx ~]# chmod u+w /etc/sudoers //添加文件的写权限

[root@adx ~]# vim /etc/sudoers

进入编辑模式,查找/root,找到这一 行:"root ALL=(ALL) ALL"在起下面添加"xxx ALL=(ALL) ALL"(这里的xxx是你的用户名),然后保存退出。

76 root ALL=(ALL) ALL

77 wm ALL=(ALL) ALL

撤销文件的写权限

[root@adx ~]# chmod u-w /etc/sudoers

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值