
3)密码设置完后,设置一下权限: [root@lu ~]# usermod -g root xiaoming
4)赋予权限以后,执行su命令看一下是否是管理员,以
5)执行vi /etc/passwd 打开文件查看xiaoming和root是否在一个用户组:
xiaoming:x:1000:0::/home/xiaoming:/bin/bash
6)修回到root,再次执行vim /etc/passwd 修改a为b:
[xiaoming@lu root]$ su root
a.xiaoming:x:1000:0::/home/xiaoming:/bin/bash
b.xiaoming:x:0:0::/home/xiaoming:/bin/bash
7)重复执行步骤4) 查看是否是管理员:
[root@lu ~]# su xiaoming
[root@lu root]#
8)步骤7) 不再是$开头的普通用户,修改成功。
PS.命令如下
删除该管理员账户:
1) 把权限改回来
分类: 电脑/网络 >>反病毒解析:
创建新的帐号有几种方法. 我们将使用最基本的方法useradd命令. 基本上, 所有您要输入的(记住,作为root!)就是:
[root@bigdog /root]# useradd blarg
[root@bigdog /root]#
好, 现在让我们登录:
Red Hat Linux release 5.1 (Manhattan)
Kernel 2.0.34 on an i586
login: blarg
Password:
Login incorrect
login:
因为不知道blarg的口令, 我们只是按[Enter]. 那不是正确的口令. 那么, 您为新的帐号分配的口令是什么呢?
#口令
passwd命令可以用来:
为新创建的用户分配口令.
修改已存在的用户的口令.
修改您登录的用户的口令.
前两种情况实际上是一样的一个新创建的用户和一个已存在五年的用户没什么区别(至少对passwd是这样). 记住您必须以root登录, 并且您必须哪个帐户的口令是您想修改的. 用我们刚才创建的帐号, 来试一下passwd:
[root@bigdog /root]# passwd blarg
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully
[root@bigdog /root]#
您可能已经猜到, 口令不会显示出来. 您还必须输入两次口令, 以确保您没有输错. 让我们再来试一下用新帐号登录:
Red Hat Linux release 5.1 (Manhattan)
Kernel 2.0.34 on an i586
login: blarg
Password:
[blarg@bigdog blarg]$
一旦您登录了一个帐号, 您可以用passwd命令来修改口令. 这时会询问您当前的口令, 然后是新口令:
[blarg@bigdog blarg]$ passwd
Changing password for blarg
(current) UNIX password:
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully
[blarg@bigdog blarg]$
就这么简单.
1、添加用户,首先用adduser命令添加一个普通用户,命令如下: #adduser tommy //添加一个名为tommy的用户#passwd tommy //修改密码
Changing password for user tommy.
New UNIX password: //在这里输入新密码
Retype new UNIX password: //再次输入新密码
passwd: all authentication tokens updated successfully.
2、赋予root权限方法一:修改/etc/sudoers 文件,找到下面一行,把前面的注释(#)去掉
## Allows people in group wheel to run all commands
%wheel ALL=(ALL) ALL
然后修改用户,使其属于root组(wheel),命令如下:
#usermod -g root tommy
修改完毕,现在可以用tommy帐号登录,然后用命令 su - ,即可获得root权限进行 *** 作。
方法二:修改/etc/sudoers 文件,找到下面一行,在root下面添加一行,如下所示:
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
tommy ALL=(ALL) ALL
修改完毕,现在可以用tommy帐号登录,然后用命令 su - ,即可获得root权限进行 *** 作。
方法三:修改/etc/passwd 文件,找到如下行,把用户ID修改为 0 ,如下所示:
tommy:x:500:500:tommy:/home/tommy:/bin/bash修改后如下tommy:x:0:500:tommy:/home/tommy:/bin/bash
保存,用tommy账户登录后,直接获取的就是root帐号的权限。
友情提醒:虽然方法三看上去简单方便,但一般不推荐使用,推荐使用方法二。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)