New answers tagged password
This essentially does nothing more than changing the username to !user, so if you try to login as user you will get: No passwd entry for user 'user' as the username has been changed to !user. Now if you change the /etc/shadow too and set the username as !user, then you can login as the user !user using the same password used for user. If you want to ...
From wikipedia : "!" – the account is password locked, user will be unable to log-in via password authentication but other methods (e.g. ssh key) may be still allowed) In addition, it also seems that the significance of ! in /etc/passwd can vary depending on the position(colon) which it is. At this link they provide an example of entries where ...
The fact that the entry still exists in the /etc/passwd file means the user still exists. Placing a '!' at the beginning of the line is, as far as I know, not a standard procedure but it would have the effect of disabling logins for that user.
As Jeff Schaller mentions, you can disable the password caching of sudo by adding this to your /etc/sudoers file: Defaults timestamp_timeout=0 Then you can simply chown root FILE; chmod 755 FILE so that only root can edit the file but everyone can read/execute it. Alternatively, you could do su root -c nano FILE, since su does not cache passwords.
You could try printf "%s\n" 'username:encryptedpassword' | sudo chpasswd -e - that may be able to bypass the password checking enforced by PAM. The password must be pre-encrypted, e.g. as in the mkpasswd example by muru. For example: p=$(mkpasswd -m sha-512 'mysupersekretpassword') printf "%s:%s\n" 'username' "$p" | sudo chpasswd -e I'm using printf ...
There might be other, safer methods, but one way is to edit /etc/shadow. Get the encrypted form of your intended password: $ mkpasswd -m sha-512 Password: $6$zGvnR7mWtj59LfpO$t/VMNTbqyp9ykVMWUhsXghVvJ15iGDiFwvhNYaJIbBy8iM9E/vHSTmbBa0iotCLBA.MGBM949tyoxrjX81Qkg1 That's encrypted form of foo, in case you're wondering. Edit /etc/shadow: sudo vipw -s ...
You can manually change password as admin. Just login and do the following: Input: # passwd whitecat Output should be: Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
Using dscl would give dscl . -passwd /Users/myuser ""
Use chpasswd command to change the password using script root@SHW:cat password.list user1:pass1 user2:pass2 user3:pass3 root@SHW:chpasswd < password.list Above example illustrate an example of given command to change password of users namely user1,user2,user3.
Yes, you have to destroy the surface of the drive. A thermite grenade is recommended (that is what they taught us) You can make your own with a fire starter (magnesium block) and an ignition source... the goal is to create a class D fire.... impossible to put out.
The classical UNIX way is making the script setuid: $ sudo chown root gogui.sh #not necessary if root is already the owner of the file $ sudo chmod u+s gogui.sh This will set a special permission bit on the file: $ ls -l gogui.sh -rwsr-xr-x 1 root root [omitted] gogui.sh (Notice the letter s instead of x in the fourth position.) If you do this, all ...
Since you're specifically referring to sudo, stick to Gilles' answer. However, since your question title merely was about getting a password to a program's stdin and I had a similar situation recently: echo $(read -sp "Password: " password; echo $password) | yourcommand I'll probably earn some bashing for that, but it worked. Speaking of bash, there you ...
EDIT Just noticed in your comments you mentioning Unity, so it appears you're running Ubuntu. My original answer was geared toward SysVinit systems, but commands like telinit still exist for compatibility and will work on distros using Systemd or Upstart. SysV way telinit 5 On modern Systemd systems, telinit is redirected to systemctl. Systemd way ...
Passing a password to sudo in a script is utterly pointless. Instead, add a sudo rule adding the particular command you want to run with the NOPASSWD tag. Take care that the command-specific NOPASSWD rule must come after any general rule. saeid ALL = (ALL:ALL) ALL saeid ALL = (root) NOPASSWD: service lightdm start But this is probably not useful anyway. ...
There are some options, and one of them is to add the specific command using visudo with the NOPASSWD flag: %wheel ALL=(ALL) NOPASSWD: /path/to/myscript cat /path/to/myscript #!/bin/bash service lightdm start
Thanks to two other SE posts (one on SO, one on SF), the answer lies in using advanced control syntax. The auth required pam_unix.so try_first_pass nullok # and sometime later auth optional pam_ssh.so use_first_pass should therefore become auth [success=1 new_authtok_reqd=1 ignore=ignore default=ignore] pam_unix.so try_first_pass nullok auth required ...
A quick look at the source indicates that auth-passwd.c includes <pwd.h> & auth-shadow.c includes <shadow.h>. Without doing to deep of a dive, it seems that sshd does use the system calls to check the password. There was also code that allowed sshd to required and do a password change for expired passwords.
Am I correct that in Linux this means that sshd directly checks the /etc/passwd and /etc/shadow files if UsePAM in sshd configuration is disabled? Yes. But currently most of distributions handle login using pam, because the sessions in todays systems are getting more and more complicated. OpenSSH can communicate with shadow using <shadow.h> header ...
I think you can use anything which is supported in the /etc/shadow file. The string given in the preseed file is just put into /etc/shadow. To create a salted password to make it more difficult just use mkpasswd with the salt option (-S): mkpasswd -m sha-512 -S $(pwgen -yns 16 1) mypassword ...
Top 50 recent answers are included