Linux系统普通用户切换省略输入用户名密码

来源:互联网 发布:文件阅读软件 编辑:程序博客网 时间:2024/06/07 03:27
今天没事,做了个小实验,普通用户切换如何省略密码1、省略密码验证 很简单,只需把/etc/passwd中的root:x:0:0:root:/root:/bin/bash,改为root::0:0:root:/root:/bin/bash,就可以了,就是去掉了里面的x,这样root用户就不用密码了。其他用户也一样。[root@localhost ~]# useradd   user01[root@localhost ~]# passwd   user01Changing password for user user01.New UNIX password: BAD PASSWORD: it is based on a dictionary wordRetype new UNIX password: passwd: all authentication tokens updated successfully.[root@localhost ~]# useradd   user02 [root@localhost ~]# passwd  user02Changing password for user user02.New UNIX password: BAD PASSWORD: it is based on a dictionary wordRetype new UNIX password: passwd: all authentication tokens updated successfully.创建完用户名密码后,现在切换下用户[root@localhost ~]# su - user01[user01@localhost ~]$ whoami user01[user01@localhost ~]$ su - user02口令:[user02@localhost ~]$ 输入用户口令后,才能切换[user02@localhost ~]$ su - 口令:[root@localhost ~]# [root@localhost ~]# vim /etc/passwd将x去掉user01:x:502:502::/home/user01:/bin/bashuser02:x:503:503::/home/user02:/bin/bash修改为如下格式user01::502:502::/home/user01:/bin/bashuser02::503:503::/home/user02:/bin/bash保存后再进行切换实验,[root@localhost ~]# su - user01[user01@localhost ~]$ whoami user01[user01@localhost ~]$ su - user02[user02@localhost ~]$ whoami user02[user02@localhost ~]$ 现在可以实现无密码切换用户

原创粉丝点击