passwd

sudo,su,passwd,chsh命令详解

对着背影说爱祢 提交于 2020-12-16 10:44:08
sudo意思就是super-user do,让当前用户暂时以管理员的身份root来执行这条命令。 su是用来改变当前用户。 su root,就是将当前用户切换为roo。用了su root之后,下面所有的命令就可以不用打sudo了,因为当前用户已经是管理员root了。 root 用户为根用户,也就是 系统管理员。root拥有全部权限。 su [用户名] 切换到其它用户,默认切换到root用户。提示密码为将切换用户密码。可选参数: -f 快速切换,忽略配置文件 -l 重新登录 -p 不更改环境变量 -c <命令> 切换后执行命令,并退出切换 sudo [命令] 以其它用户的身份执行命令,默认以root的身份执行。提示密码为当前用户密码. 可选参数: -s 切换为root shell -i 切换为root shell,并初始化 -u <用户名|UID> 执行命令的身份 -l 显示自己的权限 passwd [用户名] 设定用户密码 . 可选参数: -d 清除密码 -l 锁定用户 -e 使密码过期,在下次登录时更改密码 -S 显示密码认证信息 -x <天数> 密码过期,最大使用时间-n <天数> 冻结密码,最小使用时间-s 更改登录Shell-f 更改用户信息 chsh [-s <Shell>] [用户名] 更改登录Shell 补充: 1.sudo的缺省配置 默 认时, Ubuntu为

Does the Android operating system have files like /etc/passwd, /etc/shadow, and /etc/group?

淺唱寂寞╮ 提交于 2020-01-12 01:45:07
问题 If not, how does android determine whether a user belongs to a certain group? 回答1: This thread discusses how that is done: http://groups.google.com/group/android-ndk/browse_thread/thread/adddb27c1a5438e9 It contains a broken link to a git repository though, you can find a list of name and IDs in https://android.googlesource.com/platform/system/core.git/+/master/include/private/android_filesystem_config.h. 来源: https://stackoverflow.com/questions/5144375/does-the-android-operating-system-have

passwd in one command isn't working

折月煮酒 提交于 2019-12-23 05:19:21
问题 I developed a tool to send one-line commands to different linux machines in one shot using JSch (A java library used to communicating with other machines over ssh) So our client needs to change the password on ALL machines. Google helped me reach this point: echo -e "123\n123" | passwd username Where '123' is the new password. The command executes but this is ALWAYS the output: [root@QNA-XR1 ~]# echo -e "123\n123" | passwd Changing password for root New password: Retype password: passwd:

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

此生再无相见时 提交于 2019-12-22 09:41:19
问题 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.

Change UNIX password with JAVA [closed]

懵懂的女人 提交于 2019-12-18 09:45:10
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 6 years ago . sorry if my english is so bad. i wanna ask about executing "passwd" command from Java (i use Netbeans IDE & JSCH Library) This is my code String username

Useradd using crypt password generation

瘦欲@ 提交于 2019-12-17 10:43:07
问题 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)

Problem with an expect script

心不动则不痛 提交于 2019-12-13 01:28:41
问题 I'm trying to create a script to update a password in a non-interactive way. It's working on my laptop but fails on my server. Both are running the same configuration, using Etch. This is the script: #!/usr/bin/expect -f # Change user passwd set timeout 30 strace 4 set password [lindex $argv 1] set old_password [lindex $argv 2] spawn passwd [lindex $argv 0] sleep 1 expect "(current) UNIX password: $" send "$old_password\r" expect "Enter new UNIX password: $" send "$password\r" expect "Retype

How to do conditional .htaccess password protect

一曲冷凌霜 提交于 2019-12-10 14:27:05
问题 I'm trying to password protect a specific url using a .htaccess. Different urls point to the same files but have different workings. I now need to password protect only one url. I'm trying to do this using setenvif but it doesn't seem to work. I might not fully understand the purpose or use of the apache setenv module. This is my code what doesn't seem to work SetEnvIfNoCase Host "topasswordprotect\.domain\.com$" protecturl <IfDefine protecturl> Require valid-user AuthName "Please enter your

Unix programming. Not sure how to use the passwd struct

我怕爱的太早我们不能终老 提交于 2019-12-10 14:17:26
问题 I've done some research and I'm still struggling with the passwd structure. http://www.opengroup.org/onlinepubs/000095399/basedefs/pwd.h.html I need to obtain the user ID however I dont think I'm using understanding it at all. int getpwuid_r(uid_t, struct passwd *, char *, size_t, struct passwd **); This method call returns a point to a structure that will contain all the data I need. I'm fairly confused on the parameters. struct passwd. Do I need to declare this first? struct passwd passwd?

How do I use expect to connect via ssh to a system and change the password of the host system?

别等时光非礼了梦想. 提交于 2019-12-06 11:23:20
问题 I am automating the process of: Connect to a system named "alpha" via ssh with password "alpha" for username "alpha". Once connected I would like to set the root password (to "kickass"). The system I am connecting to doesn't have a root password by default. I wrote this expect script to do the job but it doesn't work consistently. It works once and then if I change the password to test again, it waits at the "Enter new UNIX password:" prompt after issuing "sudo passwd root". Any ideas? #!/usr