passwd

Can not add new user in docker container with mounted /etc/passwd and /etc/shadow

我的梦境 提交于 2019-12-05 18:27:42
Example of the problem: docker run -ti -v my_passwd:/etc/passwd -v my_shadow:/etc/shadow --rm centos [root@681a5489f3b0 /]# useradd test # does not work !? useradd: failure while writing changes to /etc/passwd [root@681a5489f3b0 /]# ll /etc/passwd /etc/shadow # permission check -rw-r--r-- 1 root root 157 Oct 8 10:17 /etc/passwd -rw-r----- 1 root root 100 Oct 7 18:02 /etc/shadow The similar problem arises when using passwd: [root@681a5489f3b0 /]# passwd test Changing password for user test. New password: BAD PASSWORD: The password is shorter than 8 characters Retype new password: passwd:

Using shell_exec('passwd') to change a user's password

谁说我不能喝 提交于 2019-12-04 04:26:22
问题 I need to be able to change the users' password through a web page (in a controlled environment). So, for that, I'm using this code: <?php $output = shell_exec("sudo -u dummy passwd testUser testUserPassword"); $output2 = shell_exec("dummyPassword"); echo $output; echo $output2; echo "done"; ?> My problem is that this script is not changing the password for the user "testUser". What am I doing wrong? Thanks 回答1: Another option is to have a shell script, say called passwd_change.sh somewhere

How to automatically add user account AND password with a Bash script?

我的梦境 提交于 2019-12-03 17:53:47
问题 I need to have the ability to create user accounts on my Linux (Fedora 10) and automatically assign a password via a bash script(or otherwise, if need be). It's easy to create the user via Bash e.g.: [whoever@server ]# /usr/sbin/useradd newuser Is it possible to assign a password in Bash, something functionally similar to this, but automatically: [whoever@server ]# passwd newuser Changing password for user testpass. New UNIX password: Retype new UNIX password: passwd: all authentication

Using shell_exec('passwd') to change a user's password

北城以北 提交于 2019-12-01 20:48:08
I need to be able to change the users' password through a web page (in a controlled environment). So, for that, I'm using this code: <?php $output = shell_exec("sudo -u dummy passwd testUser testUserPassword"); $output2 = shell_exec("dummyPassword"); echo $output; echo $output2; echo "done"; ?> My problem is that this script is not changing the password for the user "testUser". What am I doing wrong? Thanks Another option is to have a shell script, say called passwd_change.sh somewhere that looks like this: #!/usr/bin/expect -f set username [lindex $argv 0] set password [lindex $argv 1] spawn

关于ubuntu sudo及root登录等相关

筅森魡賤 提交于 2019-11-29 11:02:29
源地址 http://zengxx1989.iteye.com/blog/477619 Ubuntu Linux有一个与众不同的特点,那就是初次使用时,你无法作为root来登录系统,为什么会这样?这就要从系统的安装说起。对于其他Linux系统来 说,一般在安装过程就设定root密码,这样用户就能用它登录root帐户或使用su命令转换到超级用户身份。与之相反,Ubuntu默认安装时,并没有 给root用户设置口令,也没有启用root帐户。问题是要想作为root用户来运行命令该怎么办呢?没关系,我们可以使用sudo命令达此目的。 sudo 是linux下常用的允许普通用户使用超级用户权限的工具,该命令为管理员提供了一种细颗粒度的访问控制方法,通过它人们既可以作为超级用户又可以作为其 它类型的用户来访问系统。这样做的好处是,管理员能够在不告诉用户root密码的前提下,授予他们某些特定类型的超级用户权限,这正是许多系统管理员所梦 寐以求的。   设置分配很简单,只要为root设置一个root密码就行了: $ sudo passwd root   之后会提示要输入root用户的密码,连续输入root密码,再使用:$ su   就可以切换成超级管理员用户登陆了! 1. 在终端执行 sudo passwd root 指令后,系统将会提示你设置一个新的 root 帐号密码。   2. 点击

How to automatically add user account AND password with a Bash script?

让人想犯罪 __ 提交于 2019-11-28 02:35:36
I need to have the ability to create user accounts on my Linux (Fedora 10) and automatically assign a password via a bash script(or otherwise, if need be). It's easy to create the user via Bash e.g.: [whoever@server ]# /usr/sbin/useradd newuser Is it possible to assign a password in Bash, something functionally similar to this, but automatically: [whoever@server ]# passwd newuser Changing password for user testpass. New UNIX password: Retype new UNIX password: passwd: all authentication tokens updated successfully. [whoever@server ]# You can run the passwd command and send it piped input. So,

Useradd using crypt password generation

别说谁变了你拦得住时间么 提交于 2019-11-27 12:27:55
I am working on what I thought was a very simple script to dynamically create an FTP user using 'useradd' There are several parts of this process I am unfamiliar with, and an entire day's research has not gotten me too far. Here is what I have: password="pass" pass=$(perl -e 'print crypt($ARGV[0], "wtf")' $password) useradd -d HOME_DIR -s /bin/bash -g GROUP -p $pass -f -1 testing Notes HOME_DIR and GROUP are placeholders I am not having issues with the home/base_dir (-d, -b) or group (-g) functionality of 'useradd' Topics: Why are my password generation efforts not working? is /bin/bash the