date
int64
1,220B
1,719B
question_description
stringlengths
28
29.9k
accepted_answer
stringlengths
12
26.4k
question_title
stringlengths
14
159
1,526,032,904,000
After setup ubuntu with default settings, It allows user to login with password, so I use passwd -l [username] to forbid password login both in ssh and console. But when I use sudo to execute commands, it needs password so I can't use sudo any more. Is there any solution that I can use sudo again, another question is how to forbid password login both in ssh and console but keep sudo password auth available?
You could boot up in single user mode to get a root console. You could then mount your filesystem, and fix the affected account. (This is assuming grub hasn't been password locked also ..., you hold down shift during boot to bring up grub, and add 'single' to the boot statement after the word 'splash' ) As for best practice, I agree with strugee's comment. Just remembered- Ubuntu has that 'recovery mode' grub option, so you may not even have to edit your boot command...
Can't sudo after lock password, can I recover from that?
1,438,270,154,000
I configured my ftp user's home dir to /var/www and set a password but I cannot login with ftp 127.0.0.1, it keep giving me 530 Login incorrect. Why is this? I'm sure I have typed the password right. edit 1 My config /etc/vsftpd.conf looks like: # Example config file /etc/vsftpd.conf # # The default compiled in settings are fairly paranoid. This sample file # loosens things up a bit, to make the ftp daemon more usable. # Please see vsftpd.conf.5 for all compiled in defaults. # # READ THIS: This example file is NOT an exhaustive list of vsftpd options. # Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's # capabilities. # # # Run standalone? vsftpd can run either from an inetd or as a standalone # daemon started from an initscript. listen=YES # # Run standalone with IPv6? # Like the listen parameter, except vsftpd will listen on an IPv6 socket # instead of an IPv4 one. This parameter and the listen parameter are mutually # exclusive. #listen_ipv6=YES # # Allow anonymous FTP? (Disabled by default) anonymous_enable=NO # # Uncomment this to allow local users to log in. local_enable=YES # # Uncomment this to enable any form of FTP write command. write_enable=YES # # Default umask for local users is 077. You may wish to change this to 022, # if your users expect that (022 is used by most other ftpd's) #local_umask=022 # # Uncomment this to allow the anonymous FTP user to upload files. This only # has an effect if the above global write enable is activated. Also, you will # obviously need to create a directory writable by the FTP user. #anon_upload_enable=YES # # Uncomment this if you want the anonymous FTP user to be able to create # new directories. #anon_mkdir_write_enable=YES # # Activate directory messages - messages given to remote users when they # go into a certain directory. dirmessage_enable=YES # # If enabled, vsftpd will display directory listings with the time # in your local time zone. The default is to display GMT. The # times returned by the MDTM FTP command are also affected by this # option. use_localtime=YES # # Activate logging of uploads/downloads. xferlog_enable=YES # # Make sure PORT transfer connections originate from port 20 (ftp-data). connect_from_port_20=YES # # If you want, you can arrange for uploaded anonymous files to be owned by # a different user. Note! Using "root" for uploaded files is not # recommended! #chown_uploads=YES #chown_username=whoever # # You may override where the log file goes if you like. The default is shown # below. #xferlog_file=/var/log/vsftpd.log # # If you want, you can have your log file in standard ftpd xferlog format. # Note that the default log file location is /var/log/xferlog in this case. #xferlog_std_format=YES # # You may change the default value for timing out an idle session. #idle_session_timeout=600 # # You may change the default value for timing out a data connection. #data_connection_timeout=120 # # It is recommended that you define on your system a unique user which the # ftp server can use as a totally isolated and unprivileged user. #nopriv_user=ftpsecure # # Enable this and the server will recognise asynchronous ABOR requests. Not # recommended for security (the code is non-trivial). Not enabling it, # however, may confuse older FTP clients. #async_abor_enable=YES # # By default the server will pretend to allow ASCII mode but in fact ignore # the request. Turn on the below options to have the server actually do ASCII # mangling on files when in ASCII mode. # Beware that on some FTP servers, ASCII support allows a denial of service # attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd # predicted this attack and has always been safe, reporting the size of the # raw file. # ASCII mangling is a horrible feature of the protocol. #ascii_upload_enable=YES #ascii_download_enable=YES # # You may fully customise the login banner string: #ftpd_banner=Welcome to blah FTP service. # # You may specify a file of disallowed anonymous e-mail addresses. Apparently # useful for combatting certain DoS attacks. #deny_email_enable=YES # (default follows) #banned_email_file=/etc/vsftpd.banned_emails # # You may restrict local users to their home directories. See the FAQ for # the possible risks in this before using chroot_local_user or # chroot_list_enable below. #chroot_local_user=YES # # You may specify an explicit list of local users to chroot() to their home # directory. If chroot_local_user is YES, then this list becomes a list of # users to NOT chroot(). # (Warning! chroot'ing can be very dangerous. If using chroot, make sure that # the user does not have write access to the top level directory within the # chroot) chroot_local_user=YES #chroot_list_enable=YES # (default follows) #chroot_list_file=/etc/vsftpd.chroot_list # # You may activate the "-R" option to the builtin ls. This is disabled by # default to avoid remote users being able to cause excessive I/O on large # sites. However, some broken FTP clients such as "ncftp" and "mirror" assume # the presence of the "-R" option, so there is a strong case for enabling it. #ls_recurse_enable=YES # # Customization # # Some of vsftpd's settings don't fit the filesystem layout by # default. # # This option should be the name of a directory which is empty. Also, the # directory should not be writable by the ftp user. This directory is used # as a secure chroot() jail at times vsftpd does not require filesystem # access. secure_chroot_dir=/var/run/vsftpd/empty # # This string is the name of the PAM service vsftpd will use. pam_service_name=vsftpd # # This option specifies the location of the RSA certificate to use for SSL # encrypted connections. rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem # This option specifies the location of the RSA key to use for SSL # encrypted connections. rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key allow_writeable_chroot=YES and permissions are set to 777: reg@regDesktopHome:~$ ls -ld /var/www/ drwxrwxrwx 11 root root 4096 Feb 19 20:42 /var/www/ And the log file at /var/log/vsftp.log only says: Tue Feb 25 21:19:38 2014 [pid 18250] CONNECT: Client "127.0.0.1" Tue Feb 25 21:19:46 2014 [pid 18249] [ftp] FAIL LOGIN: Client "127.0.0.1" Oh and syslog-ng doesn't say anything at /var/log/messages
To enable all operating system users of the local computer to log in to ftp: Edit /etc/vsftpd.conf, set the line local_enable=YES then restart ftp with service vsftpd restart Put this here: http://www.linuxintro.org/wiki/Set_up_an_ftp_server
vsftp user authentication problems
1,438,270,154,000
Please do not ask why, but is it possible to do it? p/s: I know it's not a good thing, let's just say someone from the top management who is computer illiterate want some sort of control over the server.
Don't do that... you can either give them root's password or you could execute sudo passwd root (this assumes that sudo is set to use the users password or no password, and that passwd is a command that sudo has authorized to be run by that user).
How to give a normal user permission to change root password
1,438,270,154,000
Apparently there is a function (getpwnam) that given a username, will return the appropriate entry in /etc/passwd with the other details for that user (shell, uid, gid, etc.). However, I have no idea how to get that function working with the shadow password file (/etc/shadow). Is this possible? The application will be running as root.
The whole point of the shadow password file is that getpwnam doesn't return passwords from it. You need to look at man 3 shadow and getspnam in particular.
How to get hashed password in /etc/shadow using getpwnam()?
1,438,270,154,000
I'm not asking about password vs key authentication. I've seen a few times (and even Amazons AWS) says that even if SSH has a major vulnerability that key authentication would make such an exploit less vulnerable. But, what if there is an exploit with how the keys are verified; isn't this just making an assumption based on the authentication mechanisms? Why is this the thought? Is it because we all know passwords are a poor form of authentication so the assumption has just been "use a private key"?
I think what you're referring to is what's called the challenge-response model. With this approach the key pairs are never exposed in a manner that they could be sniffed off the wire, as is the case with sending a password over the line. And so it's deemed much safer because of this fact. One of the answers to this security SE Q&A titled: Is using a public-key for logging in to SSH any better than saving a password? explains the advantages of using a public/private key pair. excerpt In the public key case, we have a very different situation. In this case, the server has the public key of the user stored. What happens next is that the server creates a random value (nonce), encrypts it with the public key and sends it to the user. If the user is who is supposed to be, he can decrypt the challenge and send it back to the server, who then confirms the identity of the user. It is the classic challenge-response model. So given the manner in which the key pairs are used by sending a NONCE, they're never truly being exposed to being known by a man in the middle, and only the public side of the key is out in the open. If you're truly suspicious you can abandon use of this key pair, and simply regenerate a brand new set. What's a NONCE? excerpt In security engineering, a nonce is an arbitrary number used only once in a cryptographic communication. It is similar in spirit to a nonce word, hence the name. It is often a random or pseudo-random number issued in an authentication protocol to ensure that old communications cannot be reused in replay attacks. For instance, nonces are used in HTTP digest access authentication to calculate an MD5 digest of the password. The nonces are different each time the 401 authentication challenge response code is presented, thus making replay attacks virtually impossible. References Cryptographic nonce Challenge–response authentication
How is using a public-key for logging in to SSH any better than using a password?
1,438,270,154,000
Is there a way with either commands passwd or chage to force the password to expire 90 days from the time of command execution? I know I can do it by date, such as: chage -E "2014-07-31" userid But I'm looking for a way to do it by with a number instead of a specific date. Thank you!
chage doesn't handle date differences by itself, but you can let the shell take care of that and give chage a number of days since 1970-01-01 instead of a YYYY-MM-DD date representation: chage -E $(( $(date +%s)/3600/24 + 90 )) userid (Replace 90 with any number of days.) Changing the expiration date of the password rather than the account is a little trickier — in fact, you cannot set an actual expiration date for the password, just a maximum age (using chage -M). To compute the maximum age required for the password to expire 90 days from now, we need to jump through a few more hoops: userid=johndoe pwd_age=$(grep "^$userid:" /etc/shadow | cut -d: -f 3) now=$(( $(date +%s) / 3600 / 24 )) age_at_expiry_date=$(( $now + 90 - $pwd_age )) chage $userid -M $age_at_expiry_date If you don't mind it being rather convoluted, you can even combine that into a one-liner: userid=johndoe chage $userid -M $(( $(date +%s) / 3600 / 24 + 90 - $(grep "^$userid:" /etc/shadow | cut -d: -f 3) )) If you don't mind overwriting the date when the password was last changed, you can just chage -M 90 -d $(date +%F) userid
Resetting password expiry date by number of days instead of specifying date
1,438,270,154,000
If we forget our Linux root password, we can change it by changing grub's boot options. But in this case, we also set a grub password and forgot both passwords. How can we recover both?
Boot from a LiveCD, then mount the / harddrive partition. You can now chroot into your harddrive and just run passwd as root there changing the root pw. That's also the way to change to grub password.
How to reset Linux root and grub passwords?
1,438,270,154,000
Prompted for a system password on an AntiX Live USB/CD and it's not root...
AntiX's default password is demo
What is AntiX's root default password?
1,438,270,154,000
I have a box I would like to distribute as a Vagrant box (and eventually Dockerfile). the initial password specified in the README file, I'd like to detect if it is being used (it's very simple and is 4 characters long) and warn the user on login that they need to change it. Is this possible? I don't see anything that hints this in /etc/ssh/sshd_config An acceptable workaround if not would be reading the number of keystrokes and if 4 are detected warn the user that way. A REALLY good feature would be to change the password if the user doesn't reply after 3 times. (NOTE: I'm following a tip from a reviewer that this is a better place to post this question than stack overflow proper)
Instead of doing this complicated approach, you should set the users password to expired so they must change it on the next login. From man passwd: -e, --expire Immediately expire an account's password. This in effect can force a user to change his/her password at the user's next login. So to set the password of user1 to expired, use passwd -e user1
Is there a way to detect the user's password entry in sshd to warn that they must change it?
1,438,270,154,000
What is the default password for Kali on Windows 10 via Windows Subsystem for Linux?
Traditional Kali Searching for this via Google it appears to be toor for the root user. Notice it's just the name root backwards which is a typical hacker thing to do on compromised systems, as an insider's joke. If you happened to provide a password during the installation, then this would be the password to use here instead of the default toor. Kali on WSL NOTE: WSL = Windows Subsystem for Linux. In this particular flavor of Kali the root password appears to be randomly generated for the root user. To get into root you simply use sudo su instead. Reference: Thread: Unable to 'su root' in kali on WSL I'm sure the root password is randomly generated in WSL. It's irrelevant though, just type Code: sudo su What's WSL? So there are various flavors to Kali. You can download it and install it natively as a bare OS, you can also go into the Window's App Store and install it as an addon. For the past few weeks, we’ve been working with the Microsoft WSL team to get Kali Linux introduced into the Microsoft App Store as an official WSL distribution and today we’re happy to announce the availability of the “Kali Linux” Windows application. For Windows 10 users, this means you can simply enable WSL, search for Kali in the Windows store, and install it with a single click. This is especially exciting news for penetration testers and security professionals who have limited toolsets due to enterprise compliance standards. For an overview of what limitations there are in WSL see this U&L Q&A titled: Attempting to run a regular tunnel in Debian version 9.5 Linux. References Kali Linux Default Passwords Is there a default password of Kali Linux OS after first installation? I cannot log into Kali Linux after installing it. How can I log in? Install the Windows Subsystem for Linux
Default password for Kali Linux on Windows 10?
1,438,270,154,000
My objective: Automate scp from one server to another taking inputs from user Challenge: I can not setup ssh authorized host equivalence between the servers because one user having access to target will also get access to source server So, I need to setup legacy method of providing password when prompted and then do scp. Here is my code L_SRC_SID=source L_SID=target MOUNT_POINT=app07 SERVICE_PASS=some$value APP_SERVER_1=hostname SRC_MOUNT_POINT=app01 #And now transfer the file over /usr/bin/expect -c " set timeout 1 cd /$MOUNT_POINT/$L_SID/apps spawn scp -pr * apps@$APP_SERVER_1:/$SRC_MOUNT_POINT/$L_SRC_SID/apps . expect yes/no { send yes\r ; exp_continue } expect password: { send $SERVICE_PASS\r } expect 100% sleep 1 exit " exit Challenges: 1. I am unable to assign some$value value to variable SERVICE_PASS 2. How to make the expect send script work using such a variable that has $ character in the password. It is failing with the below error. password: can't read "value": no such variable Any help is appreciated I have changed the code as per suggestions, but still getting the same error L_SRC_SID=source L_SID=target MOUNT_POINT=app07 SERVICE_PASS='some$value' APP_SERVER_1=hostname SRC_MOUNT_POINT=app01 #And now transfer the file over /usr/bin/expect -c " set timeout 1 cd /$MOUNT_POINT/$L_SID/apps spawn scp -pr * apps@$APP_SERVER_1:/$SRC_MOUNT_POINT/$L_SRC_SID/apps . expect yes/no { send yes\r ; exp_continue } expect password: { send $SERVICE_PASS\r } expect 100% sleep 1 exit " exit Here is the complete error. password: can't read "value": no such variable while executing "send some$value\r " invoked from within "expect password: { send some$value\r }"
Because you're using double quotes for the expect script body, you have to deal with both shell variable expansion and expect (i.e. Tcl) variable expansion. When expect is running, the shell variable has been expanded, so expect sees this: expect password: { send some$value\r } So now, you need to deal with Tcl variables. You could add more quoting: /usr/bin/expect -c " ... expect password: { send {$SERVICE_PASS}; send \r } But that's not necessary: I would put the expect script in single quotes, and pass the shell parameters through the environment. That way, each variable will only be substituted once: either in the shell or in expect, and you won't get any surprises. export L_SRC_SID L_SID MOUNT_POINT SERVICE_PASS APP_SERVER_1 SRC_MOUNT_POINT /usr/bin/expect -c ' # <- single quote set timeout -1 cd /$env(MOUNT_POINT)/$env(L_SID)/apps spawn scp -pr * apps@$env(APP_SERVER_1):/$env(SRC_MOUNT_POINT)/$env(L_SRC_SID)/apps . expect { yes/no { send yes\r ; exp_continue } password: { send $env(SERVICE_PASS)\r } } expect eof ' In general, use of sleep in expect means you either have the wrong timeout or you're expecting the wrong thing. I changed both.
How to assign value to a variable when the value contain a $ character in it
1,438,270,154,000
I have XFCE Debian on an old PowerPC PowerBook G4. When I go to open Synaptic Package Manager, a window pops up asking for my administrative password. I enter the password I normally use for sudo in Terminal, but it doesn't work. I enter nothing, but it doesn't work. I try various other ones - like 'debian', 'synaptic' and 'password', but that doesn't work either. Why doesn't it work?
The password you use for sudo is your password. The administrative password is the password of the user root. If you forgot it, set it up again: % sudo su - [sudo] password for *your user*: *enter pwd for your user* # passwd *enter new password for user root* # ^D
debian not accepting administrative password
1,438,270,154,000
Ok, so I have some code that consists of two processes: (a) a parent/ launcher process, (b) a child process. (a) has a password that it needs to safely pass to (b). For reasons I won't go into here, I can't pass the password by opening a pipe between the two. I'm considering having (a) create a modified environment for (b) (using the env argument here, FWIW) that contains a password environment variable. My hope is that this environment variable with the password will not be accessible outside the context of process (b). Is that correct? Ideally I need to have this be secure on both Linux and Unix systems.
My hope os that this environment variable with the password will not be accessible outside the context of process (b). Is that correct? No, you should not rely on this. For example, on Linux, a process run by the same user can have access to your environment through /proc/<pid>/environ Try: tr '\0' '\n' < /proc/$$/environ (or with the PID of any of your processes)
Can the environment variables for a modified environment be accessed externally?
1,438,270,154,000
I was looking at my companies hashing implementation and I saw that the passwords for the root user are stored in base64 encoding. What is to stop anyone from simply copying the password and doing a base64 -d on it? Or for someone to do the same thing to any other base64 password? Am I missing something here?
A hash isn't an encoding, it's a non-reversible mathematical transformation. You can't take a hash and reverse the calculation to find the original value: you can only try brute-forcing a hash by trying passwords and hashing them to see if the hash matches. Passwords are typically stored as a base64-encoded, salted hash of the password. It's the hash part that makes the password unrecoverable (and the salt part means that pre-generated lists of hashes are useless). Ideally the hash itself uses a lengthy calculation, so that brute-forcing is more expensive (we don't care about the cost of hashing in the nominal case since you only need to run one hash to determine whether a user-supplied password is valid). For more information, see How to securely hash passwords?
What is the point of hashing?
1,438,270,154,000
So far while surfing web I've discovered nice addition to my gpg password generator and I've decided to adjust my alias with these commands. Here is the code gpg --gen-random 1 20 | perl -ne'print "Your password: ";s/[\x00-\x20]/chr(ord($^N)+50)/ge;s/([\x7E-\xDB])/chr(ord($^N)-93)/ge;s/([\xDC-\xFF])/chr(ord($^N)-129)/ge;print $_, "\n"' Here is what I've tried so far: alias genpass() { gpg --gen-random 1 $1 | perl -ne' print "Your password: "; s/[\x00-\x20]/chr(ord($^N)+50)/ge; s/([\x7E-\xDB])/chr(ord($^N)-93)/ge; s/([\xDC-\xFF])/chr(ord($^N)-129)/ge; print $_, "\n"' } but error occurs when spawning new instance of bash: bash: /home/user/.bashrc: line 18: syntax error near unexpected token `(' bash: /home/user/.bashrc: line 18: `alias genpass()' I cannot figure out how this token should be properly escaped.
You have the alias statement when you don't need it, what you're actually creating is a function, replace the word alias with function and it will work as expected. You also don't actually need function either, you could just have the following and it will work as expected; genpass() { gpg --gen-random 1 $1 | perl -ne' print "Your password: "; s/[\x00-\x20]/chr(ord($^N)+50)/ge; s/([\x7E-\xDB])/chr(ord($^N)-93)/ge; s/([\xDC-\xFF])/chr(ord($^N)-129)/ge; print $_, "\n"' }
Alias for perl script
1,438,270,154,000
This is what I plan to do: #!/bin/bash sudo -i <<'EOF' iptables-save | awk '/^[*]/ { print $1 } /^:[A-Z]+ [^-]/ { print $1 " ACCEPT" ; } /COMMIT/ { print $0; }' | iptables-restore EOF I will save the above and call it cleariptables.sh. I will set it as executable. It will be placed in a folder called bin in the following path: /home/cymbal/bin/ (where cymbal is the username) I will create a shortcut to cleariptables.sh on the desktop. The contents of the shortcut will be: [Desktop Entry] Version=1.0 Type=Application Terminal=true Icon[en_US]=nm-device-wired Name[en_US]=ClearIPtables Exec=gksudo /home/cymbal/bin/cleariptables.sh Comment[en_US]=Flush iptables filters Name=ClearIPtables Comment=Flush iptables script Icon=nm-device-wired Whenever I click on the desktop shortcut, I will be prompted to enter the password and the script will run. Question: Clicking on the desktop shortcut prompts me for the password. As there is a sudo -i in the script, will I be prompted again for the password?
You can use NOPASSWD directive in your sudoers file. Add this line to your /etc/sudoers file your_login ALL = (root) NOPASSWD: /path/to/your/script When editing this file, you should use the visudo command instead of a regular text editor. This will check for syntax errors before saving your changes.
Will I be prompted for the sudo password a second time?
1,438,270,154,000
I'm using the pass application which I find really handy. I want to change the keyphrase (mother password). I had a look at the man page there but i'm not sure what to do. Do I have to use the init command?. Is it possible to change the passphrase without reinitializing a pass store from scratch? If yes which exact command should be done? I tried the following from the comments: Many thank for your comment So I did the following: $ gpg --list-secret-keys /Users/user/.gnupg/pubring.kbx ------------------------------- sec .... .... uid [ultimate] firstnamelastname <[email protected]> ssb ... sec .... .... uid [ultimate] Firstname Lastname <[email protected]> ssb ... Note the email adress is the same There is no file ~/.gnupg/gpg.conf. I created a one and wrote default-key firstnamelastname in it and source it but got gpg.conf:1: command not found: default-key
pass uses gpg to encrypt your password store. To change the passphrase for pass, you need to change the passphrase for your gpg key. e.g. gpg --change-passphrase user-id
How to change the keyphrase in the pass program without reinitializing a pass store from scratch
1,438,270,154,000
I'm running a ksh script on AIX 7.2. In debug mode I want to redirect all the script does to a brkpt-file. The script also makes logins to another application and therefore uses a password (let's say "pw123_") exec > $brkpt_file 2>&1 set -xv dsmadmc -id=admin -pa=pw123_ q pr Redirection works fine, but I want to replace the passwordstring with "***" so its never visible in the brkpt-file. That works fine on commandline: echo "dsmadmc -id=admin -pa=pw123_ q pr" | sed "s/-pa=[[:graph:]]* /-pa=*** /g" result dsmadmc -id=admin -pa=*** q pr But as soon as I use this "sed" in combination with "exec": a) the output is not redirected to file anymore but on the screen b) the passwordstring is not replaced exec | sed 's/-pa.*=[[:graph:]]* /pa=*** /g' > $brkpt_file 2>&1 set-xv dsmadmc -id=admin -pa=pw123_ q pr result + dsmadmc -id=admin -pa=pw123_ q pr + ... other stuff of script How I can I get all the script stuff in the brkpt AND hide the password?
exec can't be used to pipe output directly into another program, it can only be used to redirect output to a file. Fortunately, on unix, everything is or can be made to look like it's a file. For ksh (and for POSIX compatibility), you need to create a named fifo and redirect the script's output to that. #!/bin/ksh fifo=./exec.fifo log=./exec.ksh.log # delete the fifo if it already exists [ -e "$fifo" ] && rm -f "$fifo" mkfifo "$fifo" # now run the sed script in the background. Its purpose is to modify # the input coming from the fifo before saving it to the log file ( sed -e 's/-pa=[^ ]* /-pa=*** /g' < "$fifo" > "$log" ) & # set up a function and trap to delete the fifo on exit. cleanup () { rm -f "$fifo" ;} trap cleanup EXIT # now do the exec exec > "$fifo" # and finally do something that produces some output. echo "dsmadmc -id=admin -pa=pw123_ q pr" When you run the script, the output will be filtered through sed via the fifo and then redirected to the log file: $ ./exec.ksh $ cat exec.ksh.log dsmadmc -id=admin -pa=*** q pr If you are using bash, however, it's a bit easier. You can use Process Substitution to provide a "file" to redirect the output to instead of a fifo (the fifo method still works if you prefer to write portable shell scripts). For example: #!/bin/bash exec 1> >(sed 's/-pa=[^ ]* /-pa=*** /g' > ./exec.bash.log) echo "dsmadmc -id=admin -pa=pw123_ q pr" Again, the output will be modified by sed before being saved to the log file. $ ./exec.bash $ cat exec.bash.log dsmadmc -id=admin -pa=*** q pr
How can I redirect all output of a script to a file and replace passwords?
1,438,270,154,000
I am trying to execute simple 'parallel' command parallel -S server1,server2,server3 echo "Number {}: Running on \`hostname\`" ::: 1 2 3 It asks me for passwords to the three servers, but then nothing happens. Usual ssh to these servers works fine. Once I logged in to one of the servers, system warned me about failed login to 'notty'. How can I achieve a correct execution?
"It asks me for passwords to the three servers" Looking at the documentation for GNU Parallel: "The sshlogin must not require a password" Since you are using the -S (--sshlogin) flag this is a problem. So you get asked for a password, this means GNU Parallel will not run. You need to set up ssh keys to ensure you can have password-less connections. You can follow the steps in this link to set up keys. You do say in your post that normal ssh works fine. So you maybe have ssh set up to ask for password. You can use your existing keys and add them to the authorized_keys file if this is the case.
Using 'parallel' to execute command on remote hosts - nothing is returned, failed logins
1,438,270,154,000
I want to be able to store the login details all of my remote FTP accounts in one place, securely. Then I'd like clients like autofs/curlftpfs, Filezilla, etc to use this one store of passwords. I'm not interested in GUI-dependent solutions. Is this possible somehow?
Ideally those would be SFTP accounts, using SSH public key authentication rather than passwords. You'd gain both security and convenience. But let's assume you don't have a choice of not using FTP with passwords. You could store the passwords (the .netrc file) on an encrypted filesystem and mount that filesystem only when you want to access it. A simple way to create an encrypted directory tree is encfs. Setup: # install encfs, e.g. apt-get install encfs mkdir ~/.passwords.d encfs ~/.passwords.encfs ~/.passwords.d mv ~/.netrc ~/.passwords.d ln -s .passwords.d/.netrc ~ fusermount -u ~/.passwords.d Daily use: encfs ~/.passwords.encfs ~/.passwords.d ftp … fusermount -u ~/.passwords.d
A local, centralized, secure way to store FTP login data, including passwords
1,438,270,154,000
I have modified /etc/samba/smb.conf to create a [public] share: [global] workgroup = WORKGROUP log file = /var/log/samba/log.%m max log size = 1000 logging = file panic action = /usr/share/samba/panic-action %d server role = standalone server obey pam restrictions = yes unix password sync = yes passwd program = /usr/bin/passwd %u passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* . pam password change = yes map to guest = bad user usershare allow guests = yes [public] comment = Public Storage path = /home/share valid users = @users force group = users create mask = 0660 directory mask = 0771 read only = no and then I did: sudo /etc/init.d/smbd restart sudo smbpasswd -a pi # enter a password here Unfortunately, when I access this shared folder from Windows, I need to enter a user/password login (see screenshot below). Question: how to make this Samba share accessible without any user/password login? PS: I created/mounted the shared folder like this: sudo mkdir /home/share sudo chown -R root:users /home/share sudo chmod -R ug=rwx,o=rx /home/share sudo mount /dev/sda1 /home/share
I finally found the solution: [global] workgroup = WORKGROUP netbios name = NAS log file = /var/log/samba/log.%m max log size = 1000 logging = file panic action = /usr/share/samba/panic-action %d server role = standalone server obey pam restrictions = yes unix password sync = yes passwd program = /usr/bin/passwd %u passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* . pam password change = yes map to guest = bad user usershare allow guests = yes [public] path = /home/share public = yes guest only = yes writable = yes force create mode = 0666 force directory mode = 0777 browseable = yes creates a share without any user/password login. You can access it in Windows with \\NAS\public.
How to make this Samba share accessible without any user/password login?
1,438,270,154,000
I just installed a brand new VM with Debian 10 (buster) and joined it to our active directory using pbis. what I encountered now is, that: as the root user, I can su to every other available user in our AD WITHOUT being asked for a password as a normal user I can only su to other users if I have the correct password and type it in In previous versions of Debian (like 9) it was not possible do do that. What I did to join the AD: apt install gnupg -y wget -O - http://repo.pbis.beyondtrust.com/apt/RPM-GPG-KEY-pbis | apt-key add wget -O /etc/apt/sources.list.d/pbiso.list http://repo.pbis.beyondtrust.com/apt/pbiso.list apt-get update apt-get install pbis-open -y pbis join full.domain.name.de $ADMINUSER $ADMINPW pbis set-default-domain full.domain.name.de /opt/pbis/bin/config UserDomainPrefix PREFIX /opt/pbis/bin/config AssumeDefaultDomain true /opt/pbis/bin/config LoginShellTemplate "/bin/bash" /opt/pbis/bin/config RequireMembershipOf "PREFIX\\admingoup" "PREFIX\\${HOST}-admin" "PREFIX\\${HOST}-user" /opt/pbis/bin/config HomeDirTemplate "%H/%U" sed -i '23a%admingroup ALL=(ALL) ALL' /etc/sudoers sed -i '23a%'${HOST}'-admin ALL=(ALL) ALL' /etc/sudoers so the other settings are basically standard. This is driving me crazy and I can't find out where to look what has changed since Debian 9 to the su command. edit: so basically I become root with sudo suand then go for su other.user and it just works without a password prompt. If I'm a non root user e.g. "normal.user" and go for su other.user it asks for the password and only lets me do it if I type in the correct one.
I can't find out where to look what has changed since Debian 9 to the su command. You look at packages.debian.org. In Debian 9 the su command was provided by the shadow package. In Debian 10 the su command was provided by the util-linux package. There are differences caused by this switch. "debian su - and su $PATH differences?" shows one such difference. "su vs su - (on Debian): why is PATH the same?" is a question here whose answers have been invalidated by the change. There were also several problems as a consequence, including that initially the util-linux package did not install the right PAM configurations for su. The NEWS file for util-linux also mentions that the util-linux su has multiple PAM configurations, not just one. Your BeyondTrust package installs PAM stuff in Debian. Check that it is interoperable with the different su that Debian is now providing. Further reading Laurent Bigonville (2016-08-02). Please use login/passwd implementations provided by util-linux. Debian Bug #833256. Alf Gaida (2018-07-28). Have a working su again. Debian Bug #904832. crazyworlds (2017-06-15). Cannot change root password. BeyondTrust Bug #42
Debian 10 su command to existing user as root without password
1,438,270,154,000
I am provisioning a machine using packer. The tool offers shell provisioning functionality so I am able to run whatever shell commands I want. I would like to disable ssh password login. Is there a way to do this via a command, rather than ending up writing pattern and line mathing seds for /etc/sshd_config ?
Yes, it's possible to disable password authentication via the command-line. Simply use the -o flag when running the daemon: sshd -o "PasswordAuthentication no"
Disable ssh password authentication programmaticaly
1,438,270,154,000
I am playing around with MongoDB on my localhost and when using ps aux | grep, I got this ubuntu 26701 0.2 0.6 96011 27851 pts/3 Sl+ 11:14 0:00 mongo -u mongouser -p xxxxxxxx -authenticationDatabase tmpdb the xxxxxxxx part is not censored by me, I invoked mongo client with password from command line. How does ps know it's sensitive info?
ps does not know that this is a password, so it can't "censor" it. The mongo client, on the other hand, knows this and rewrites its command string so that people can't look at it with ps. Note that there is a brief (very brief) instance between launching mongo and mongo rewriting its command line string. In this brief moment, the output from ps would include the password. The password is also stored in your shell's command line history file.
How does ps censor my password
1,438,270,154,000
I have a question about groupadd, specifically with password (-p). It says it is not recommended, "This option is not recommended because the password (or encrypted password) will be visible by users listing the processes." Can someone give me a broader explanation? How will a user see the password when viewing the processes, and if that is the case why is this used?
It's possible for a user on the system (or a monitoring program that captures ps output) to see the password as a parameter to the groupadd process -- if the user or monitor "happens" to run ps while the groupadd process is running. The risk of that happening is small (the groupadd process will likely finish running fairly quickly), but non-zero. See an example for yourself with this contrived example; execute these two lines within 10 seconds of each other: $ sh -c "echo groupadd -p password-here > /dev/null; sleep 10" & $ ps -ef | grep password
groupadd -p Not Recommended?
1,438,270,154,000
First, before I get answers containing information that I already know, yes, I'm aware that the superuser can reset passwords, and yes, I know that the superuser can log in as other users without knowing their passwords. I also know it's possible to crack an encrypted password with special programs. I'm talking about directly gaining the password a user types in, as plain text, without the need to decrypt anything. Of course, a general keylogging program can do this, I assume, but there would be a lot of junk in the output that was not related to passwords, and it may even have safety features built in to prevent this use. Is it possible for root to put a keylogging program on a machine, that is activated specifically when a user changes their password, and "intercepts" the information before it gets encrypted? It could then send this information to a secret file in root's home directory.
Yes, of course. The superuser can replace the programs that read the user's password (login, passwd, …) by versions that do their job, plus write the password out to a log. The superuser can also replace the kernel by a kernel that modifies the way programs like ls, md5sum, lsof, etc. work so that they report the modified programs looking like the normal ones, so that it would be impossible to detect that the system has been modified from the inside. You could still detect the modification by looking carefully from the outside, e.g. looking at a disk image. The superuser can even go further and modify some firmware on one of the system's main peripherals so that it injects the malware when the system boots. This represents a considerably higher level of sophistication, but it's possible, at least in principle. If you don't trust a computer's administrator, don't type your password there.
can a super user steal passwords from other users with keylogging?
1,438,270,154,000
I want to download the file from server by using a cron job, so I need to use the scp command without giving the password by keyword. How do I do it?
First step is to generate a private-public key pair on the machine you copy from: ssh-keygen You can go with the defaults, and make sure you don't provide a password for usage. This can take a bit of time. Second step, after the key generation has finished, is to copy the public key to the server using: ssh-copy-id username@server with the appropriate username and server. For this you need the password of username. If username doesn't have a password, you can copy the file with the public key via the root account, but it is much more easy to temporarily create a password for the account and use ssh-copy-id Third step: test whether the installed public key is working using: ssh username@server or scp somefile username@server:/var/tmp Fourth step: add a cron job (crontab -e) on the client machine: 15 23 * * * scp username@server:/path/on/server/downloadfile /local/destination 17 23 * * * scp /local/source/somefile username@server:/path/on/server/uploaddirectory Which will copy the file /path/on/server/downloadfile every day at 11:15 PM from the server and two minutes later starts uploading /local/source/somefile Things to consider: Depending on the security of the access to the client machine (where you are copying from) and where the unprotected private key is located, you should consider changing the username account so that it only allows scp and not ssh. If you copy the same file and the contents mostly change (e.g. appended to, not a complete rewrite), using rsync using the above ssh key pair) is more efficient.
Upload and download the files from server without giving the password
1,438,270,154,000
I have Ubuntu installed on a Raspberry pi. I have a normal user pi, but I forgot the password. However, I do have root access. How would I change pi's password using root?
Simply do : passwd username in your case passwd pi
change regular user's password with root access
1,383,934,307,000
I have created a BIOS password. I use the Dvorak keyboard layout. When I switch my keyboard layout to Qwerty and restart, and then type password in with the different layout, there is no change. However, when I'm logged into my OS, having a different keyboard layout matters. What's going on here?
Many people get confused because they see the computer as a single entity when in actuality a computer is several systems working together to give the illusion that it's one cohesive object. Multiple subsystems The BIOS is one of of these such subsystems. The BIOS is exactly what its name describes. A Basic Input and Output System. Its job is to provide basic functionality to the system so that it can detect peripherals (such as: HDDs, keyboards, monitors, etc.). The other major function that the BIOS provides is in boot strap loading the Operating System from the designated medium (CD, DVD, USB, HDD, etc.). The functionality to provide access to these peripherals provides an API which the OS and software can make use of if they so choose, but the operating systems and software don't have to make use of these APIs and often times do not, for a variety of reasons. The major reason is that the device manufacturer knows best and will often times provide a low level driver themselves which can deal with the hardware in a more intimate way than the general purpose BIOS is able to. Your question is exactly this scenario. The BIOS is able to detect the keyboard and deal with it using its own software/drivers, whereas the OS is not able to. There's really nothing more to this than that. MS-DOS API If you'd like a more concrete example then you don't have to look any further than the interrupt 21 facility that was popularized by MS-DOS. MS-DOS provided its own screen services that sat along side the BIOS' because Microsoft wanted to have either richer features or a different API altogether. See the wikipedia page: MSDOS API.
How does a BIOS password work?
1,383,934,307,000
I just wanted to brute-force my old router but the for-loop was really amateur style. How to write a nice for-loop, if I only know the charaters included? Found already that page but it does not include my case. I though of something like the following, but obviously it does not work: for word in $(cat charList)$(cat charlist); do echo ${word}; done
Brace expansion: Only consecutive characters are allowed Hirachical for-loops: This is a waste of cmd-lines I think I got a nice way: Use eval and brace expansion $ cat charList a,b,_,X,5,1,' ',-,')',3 $ eval echo "{$(cat charList)}{$(cat charList)}{$(cat charList)}" Unfortunately I have no bash now, but this should do it: $ eval "for word in {$(cat charList)}{$(cat charList)}; do echo '${word}'; done"
Using for loop to brute-force a password
1,383,934,307,000
I am using Linux Mint 20. I was working on my machine and suddenly vscode could not save the file. Then when I restarted my machine it showed the following screen. I removed the HDD to boot and posted this question. What is going on? I never set a password for my HDD.
I wonder if it is a failing hard-disk, manifesting errors in a strange way. The hard-disk will have its own operating system ( a simple one ) stored on it self. And will boot it before offering it-self to the host system. Therefore anything could happen it the drive starts failing. (However that does not explain, how it happened when in use.
One of my hard drives is asking for a password that I never set [closed]
1,383,934,307,000
I feel this question has been asked before but I am having trouble locating an answer and it combinations of possibilities is mind boggling. Many resources provide something almost close but I'm having trouble getting the expressions in grep correct for my issue. I am creating a wordlist using crunch with alphanumeric output: crunch 8 8 ABCDEFGHIJKLMNOPQRSTUVWXYZ + 1234567890 -t %@%@%@%@ This will output 8 alphanumeric strings with an alpha and a number like so: 1A1A1A1A1A 1A1A21B2A3 1A1A31A1A3 ... I have been trying to pipe the output to grep where the final result will omit output with any character in any pattern repeats. Due to the nature of the crunch output, consecutive repeats are already eliminated. Is there a correct expression to omit the non consecutive ones? Or is there a possible way to do this with just crunch? 1A1A1A1A1A not output 1A1A21B2A3 not output 1A1A31A1A3 not output acceptable output: 1A2B3C4D 1B2A3D4C 1C3A2F5G Any help with trying to understand the expressions in this regard is greatly appreciated.
With back-references: grep -v '\(.\).*\1' -v is to reverse (print the lines that don't match), and the regexp is \(.\) any single character captured, followed by any number of characters (.*) followed by the same character \1 captured earlier.
Omit string with repeating characters using grep
1,383,934,307,000
Let's say somebody sitting under user (non-admin, not root), but he didn't set up any password for it, only superuser/root has password. Is it bad practice (in context of remote access to a desktop through Internet) ?
As you point out the user may not be able to do any permanent damage to the system without admin rights but there is a lot they can do which you'd prefer they didn't. Zombie machines get used for carrying out DDOS attacks and sending spam or as proxies for carrying out further attacks. It's a particular problem with IoT devices at the moment. Those responsible for these attacks actively search the internet for machines they can login to. You might think that an obscure username is enough but that's generally not true. Attackers will try very very long lists of usernames with blank passwords. If you have any remote login to the system accessible from the internet (eg SSH or just email SMTP) then this user will be breached. There are countless bots on the internet poking every single internet IPv4 address. For reference I receive around 500 pokes per day. I've seen reports of others recieving 10,000 or even 100,000 So if you allow passwordless login on anything but a reasonably firewalled laptop with no external access you can pretty much guarantee it will be logged into and used for a further attack.
Does using non-root user without password makes system more vulnerable?
1,383,934,307,000
I created a username/password combination of the form onetwo:bucklemyshoe, ie the password file contains the single line onetwo|bucklemyshoe Whenever I try to connect the message appears on the logon page: You were disconnected for the following reason: invalid challenge response The logs display the following message Authentication required by password file authenticator module sending challenge for username 'onetwo' using hmac+sha256 digest Warning: hmac+sha256 challenge for 'onetwo' does not match Warning: authentication failed invalid challenge response Disconnecting client Protocol(ws websocket: 111.111.111.111:14333 <- 222.222.222.222:35555): invalid challenge response It makes no difference whether Insecure plain-text passwords is checked or not. The contents of the password file is not what xpra expects. Is the actual format documented somewhere? Is there an utility or script to create them in the right format?
According to the xpra mailing list where this was also asked, the password file format is documented on the wiki: Password File "file" vs "multifile": "file" contains a single password, the whole file is the password "multifile" contains a list of authentication values, see proxy server file authentication - this module is deprecated in favour of "sqlite" which is easier to configure. To make a regular password file, you just write the password in plaintext: echo -n "bucklemyshoe" > yourpasswordfile.txt
What is the correct format for xpra password files?
1,383,934,307,000
I've purchased VPS @ ovh.com, I changed my root password and now I cannot remember it, I've followed the steps on their forums but it doesn't seem to take any effect, it only changes the the password in rescue mode. Here's some of the things I've tried mount -o rw /dev/sda1 /mnt chroot /mnt passwd reboot server to normal mode & mount /dev/sda1 /mnt chroot /mnt nano /etc/shadow //changed the password with another one generated with openssl reboot server Here is /proc/mounts inside the recovery:
From looking at your cat /proc/mounts output, it turns out your recovery system is on /dev/sda1, so you were changing the password for the recovery system (which presumably is ignored and the image discarded once you reboot). Your system has already been mounted at /mnt/sdb1. It's also good practice to make sure the filesystem is cleanly unmounted, because I can't guarantee the "reboot my VPS" button does so. chroot /mnt/sdb1 passwd exit # get out of chroot umount /mnt/sdb1 # unmount the filesystem sync # just for paranoia Then you can reboot it.
resetting root password ovh
1,383,934,307,000
I have a service user srvuser and a group maintainers. How can I allow only group maintainers to become srvuser with su command? I tried editing /etc/pam.d/su: auth sufficient pam_succeed_if.so use_uid user = maintainers and user ingroup maintainers But and is apparently not allowed in the conf file. Any way to get around this?
Nothing in the documentation of pam_succeed_if seems to indicate that it would support multiple conjunctions, so you'll need to do it outside the module. If you were writing a required rule, it would be simple to combine them by creating two separate rules: auth required pam_succeed_if.so user = srvuser auth required pam_succeed_if.so use_uid user ingroup maintainers But with a sufficient rule, as in one that terminates processing when a positive result is returned, this would not work, but turn into an or condition instead. But PAM supports a sort of flow control, allowing to skip some rules based on the return value of a previous module. See the documentation here. This should flow through to the pam_permit rule as long as the pam_succeed_if modules return true, but skip to the following rules if they return anything but a success. auth [success=ok default=2] pam_succeed_if.so user = srvuser auth [success=ok default=1] pam_succeed_if.so use_uid user ingroup maintainers auth [success=done default=ignore] pam_permit.so ... # other modules As you can see, the syntax is horrible, and I would suggest testing the configuration before even trying to actually use it anywhere. Of course, to allow members of a some group to run a process with the privileges of another user, you don't necessarily need su, sudo or PAM. With the usual file permissions, you could create a setuid binary, and only allow members of a given group to execute it: # chown srvuser.maintainers ls # chmod 4510 ls # ls -l ls -r-s--x--- 1 srvuser maintainers 118280 Mar 26 19:03 ls The downside here is that unlike su and sudo, running a setuid binary is not logged anywhere, and that the setuid binary can be modified or deleted by processes running as the target user. To work around this, you could create a simple fixed-function wrapper program, to log the execution, setuid to the target, and then exec the actual command.
Using pam_succeed_if.so to allow passwordless su for a given group
1,383,934,307,000
If creating a user with a shell of /sbin/nologin, is there any benefit / need to running passwd usernamegoeshere after creating the user and setting the password to something random or is that of no benefit? I don't think this changes the answer, but this user might be used by cron for example as a way to run cron jobs with non-elevated privileges. It's not intended to be logged into by anyone via ssh, nor should they be permitted to do so.
Typically for nologin shells you may want to also lock the account or set the password to be invalid. In /etc/shadow on Linux a locked account would have a password entry looking like !! and an invalid password would be * eg on Debian Jessie: /etc/passwd:backup:x:34:34:backup:/var/backups:/usr/sbin/nologin /etc/shadow:backup:*:16274:0:99999:7::: On CentOS 7 /etc/passwd:sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin /etc/shadow:sshd:!!:16628:::::: Now it doesn't matter what is entered at the password prompt, it can not work.
Creating user with /sbin/nologin, any benefit to running passwd and setting to random
1,383,934,307,000
When I look at /etc/shadow I see several entries that look like this: username:**___________::::::: What does the "**___________" mean? That is where I should see the password hash.
A password field that starts with * means the corresponding user is not allowed to login. This is generally used for system accounts, such as mysql, mail, apache, etc. However, if the entry is literally ending with :::::::, this means the corresponding user is a NIS / NIS+ account.
What does **___________ mean in /etc/shadow?
1,383,934,307,000
I have problem on Unix, have to create a lot of passwords in smd5 but don't know how to generate smd5 passwords using some unix tool or perl in a form: {smd5}DoZgZ.OE$vSg4ZH7Bpy0BCdXNzBj001 I have never had any problems to generate anything on linux in md5/sha256/sha512 with tools like e.g. openssl I have tried with Perl using something like that: use Digest::MD5; use MIME::Base64; $ctx = Digest::MD5->new; $ctx->add('vwkfA17aF`'); $salt = 'DoZgZ.OE'; $ctx->add($salt); $hashedPasswd = '{smd5}' . encode_base64($ctx->digest . $salt ,''); print $hashedPasswd . "\n"; but unfortunatelly output is quite different : {smd5}5zJphaZULO3gnT1pwT1YHERvWmdaLk9F I do not see salt there like here {smd5}DoZgZ.OE$vSg4ZH7Bpy0BCdXNzBj001 and string is longer
AIX's {smd5} format is a non-standard one. It's a minor variant of the *BSD/Linux/Solaris “MD5” (which is the one generated by openssl passwd -1). I wasn't able to find much information about it. There is code contributed to John the Ripper (present in the 1.8.0 jumbo version) that calculates it, in the file aix_smd5_fmt_plug.c. From reading the code, it seems that the difference is that the BSD MD5 variant effectively prepends the string $1$ to the salt in one place, whereas the AIX variant doesn't. It shouldn't be very hard to patch OpenSSL to support this variant if you know C. You can change the algorithm used by AIX by editing /etc/security/pwdalg.cfg and add the line lpa_options = std_hash=true in the smd5: stanza. The normal way to do that is with the chsec command: chsec -f /etc/security/pwdalg.cfg -s md5 -a std_hash=true As far as I understand, this invalidates passwords recorded with the non-standard algorithm. Note that LDAP salted MD5 is not a good password hash, because it isn't slow. How to securely hash passwords? explains what that means. The BSD and AIX “MD5” algorithms are slow (to ideally slow, but way better than non-slow algorithms).
smd5 - generate by unix tool or perl
1,383,934,307,000
Exposition: Working inside an XSession. Some (background) deamon needs to prompt me for password input. How can I make the daemon to prompt me for a password using a popup in the Xsession? The daemon normaly normaly has no linkage to the X Session which makes it hard to spawn a prompt password popup-window. Some ideas for answers: a small program that executed (fork/child from) the daemon which makes a X-prompt-popup-window best. the smaller the better :) safety first Even though I doubt possible, any solution that makes sure that while entering password no other application running in that X Session can keylog is much appreciated.
This kind of problems is usually handled by having two stand-alone binaries: the service daemon and the user interface that communicate over a UNIX domain socket (or a network socket in case they are not running on the same machine). A prime example would be OpenSSH - check how ssh-agent, ssh-add and ssh interact to get some idea how this can be done. Replace "UNIX domain socket" with "D-Bus" if you want to get trendy or need some extra functionality that you'd have to implement. If the action request is coming from the daemon itself (which if I understand correctly) is your particular case, it is a bit trickier. The UI part should get spawned sometimes during the X session, register itself with the daemon and when the daemon decides it needs some input, it asks the UI part to do its stuff. The last two sentences are actually where D-Bus might come in handy. On the other hand, you should consider carefully, whether daemon actively asking for a password is the Right WayTM of doing things - daemons are usually services which answer requests rather than generating one. It might be better to let the UI actively push the password in, when user decides it is time to do that. I'm not saying that is the only good approach, just that it should be considered thoroughly first. As far as security is concern, everything depends on how paranoid you want to get. With X you can grab the keyboard (see XGrabKeyboard(3) man page) which should give you reasonable level of security. Or better put: if you don't use it, you have no control of the password whatsoever. Again, ssh is a good example: have a look at the x11-ssh-askpass helper. Its homepage doesn't seem to work any more, but you can find the sources in many places, for example in the openSUSE BuildService. You can actually even use it directly, since all it does is grabbing the keyboard and outputting the entered password on its standard output, so all you need is to spawn the askpass helper and check its stdout. If I recall correctly, readpass.c in OpenSSH should give you some idea about how to do it. While all this may look a bit overcomplicated and far from secure, there are several things to consider: several projects usually considered reasonably secure like OpenSSH and GPG use this approach. Security is hard. Rolling out one's own security solutions usually ends with troubles (or disasters) one way or another (it can also become the usual enterprise-y: "I've got this cool thing." - "Wow, let's make it a new company tool" - 5 years later: "It's completely inextensible/broken/insecure/... - how could have anybody made this a company-wide solution?!" Substitute "company-wide solution" with "our flagship product" for hours of laughter). Also see the canonical Security SE Q&As: https://security.stackexchange.com/questions/18197/why-shouldnt-we-roll-our-own and https://security.stackexchange.com/questions/2202/lessons-learned-and-misconceptions-regarding-encryption-and-cryptology. Keyboard grabbing doesn't say anything about any other application not eavesdropping on the keyboard events somewhere deeper in the stack (i.e. under the X application layer). But then again, such an application would very likely require some sort of root access, hence if you had something like that on the system, you might as well put the passwords into a plain text file named passwords.txt in your home directory).
How to let a daemon prompt for a password (in Xsession, keyloggersafe)?
1,383,934,307,000
I've created a local port forwarding and I was trying to ssh into my own port. During the process, I found that my own Linux won't recognize me even when I have the right password chulhyun@chulhyun-Inspiron-3420:~$ su password: root@chulhyun-Inspiron-3420:/home/chulhyun# ssh root@localhost -p 2200 root@localhost's password: Permission denied, please try again. root@localhost's password: root@chulhyun-Inspiron-3420:/home/chulhyun# exit exit chulhyun@chulhyun-Inspiron-3420:~$ ssh chulhyun@localhost -p 2200 chulhyun@localhost's password: Permission denied, please try again. I've tried it both as root@localhost and chulhyun@localhost (chulhyun is my user name). In both cases I have no problem logging into the account but when I enter that password when they ask for my password during ssh'ing, they say its wrong... What am I missing here? Is there supposed to be a separate king of password for network login? update here's my sshd_config # Package generated configuration file # See the sshd_config(5) manpage for details # What ports, IPs and protocols we listen for Port 22 # Use these options to restrict which interfaces/protocols sshd will bind to #ListenAddress :: #ListenAddress 0.0.0.0 Protocol 2 # HostKeys for protocol version 2 HostKey /etc/ssh/ssh_host_rsa_key HostKey /etc/ssh/ssh_host_dsa_key HostKey /etc/ssh/ssh_host_ecdsa_key #Privilege Separation is turned on for security UsePrivilegeSeparation yes # Lifetime and size of ephemeral version 1 server key KeyRegenerationInterval 3600 ServerKeyBits 768 # Logging SyslogFacility AUTH LogLevel INFO # Authentication: LoginGraceTime 120 PermitRootLogin yes StrictModes yes RSAAuthentication yes PubkeyAuthentication yes #AuthorizedKeysFile %h/.ssh/authorized_keys # Don't read the user's ~/.rhosts and ~/.shosts files IgnoreRhosts yes # For this to work you will also need host keys in /etc/ssh_known_hosts RhostsRSAAuthentication no # similar for protocol version 2 HostbasedAuthentication no # Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication #IgnoreUserKnownHosts yes # To enable empty passwords, change to yes (NOT RECOMMENDED) PermitEmptyPasswords no # Change to yes to enable challenge-response passwords (beware issues with # some PAM modules and threads) ChallengeResponseAuthentication no # Change to no to disable tunnelled clear text passwords #PasswordAuthentication yes # Kerberos options #KerberosAuthentication no #KerberosGetAFSToken no #KerberosOrLocalPasswd yes #KerberosTicketCleanup yes # GSSAPI options #GSSAPIAuthentication no #GSSAPICleanupCredentials yes X11Forwarding yes X11DisplayOffset 10 PrintMotd no PrintLastLog yes TCPKeepAlive yes #UseLogin no #MaxStartups 10:30:60 #Banner /etc/issue.net # Allow client to pass locale environment variables AcceptEnv LANG LC_* Subsystem sftp /usr/lib/openssh/sftp-server # Set this to 'yes' to enable PAM authentication, account processing, # and session processing. If this is enabled, PAM authentication will # be allowed through the ChallengeResponseAuthentication and # PasswordAuthentication. Depending on your PAM configuration, # PAM authentication via ChallengeResponseAuthentication may bypass # the setting of "PermitRootLogin without-password". # If you just want the PAM account and session checks to run without # PAM authentication, then enable this but set PasswordAuthentication # and ChallengeResponseAuthentication to 'no'. UsePAM yes update here's the result of ssh -vvv chulhyun@localhost -p 2200 chulhyun@chulhyun-Inspiron-3420:~$ ssh -vvv chulhyun@localhost -p 2200 OpenSSH_5.9p1 Debian-5ubuntu1.4, OpenSSL 1.0.1 14 Mar 2012 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: Applying options for * debug2: ssh_connect: needpriv 0 debug1: Connecting to localhost [127.0.0.1] port 2200. debug1: Connection established. debug3: Incorrect RSA1 identifier debug3: Could not load "/home/chulhyun/.ssh/id_rsa" as a RSA1 public key debug1: identity file /home/chulhyun/.ssh/id_rsa type -1 debug1: identity file /home/chulhyun/.ssh/id_rsa-cert type -1 debug1: identity file /home/chulhyun/.ssh/id_dsa type -1 debug1: identity file /home/chulhyun/.ssh/id_dsa-cert type -1 debug1: identity file /home/chulhyun/.ssh/id_ecdsa type -1 debug1: identity file /home/chulhyun/.ssh/id_ecdsa-cert type -1 debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3 debug1: match: OpenSSH_5.3 pat OpenSSH* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1.4 debug2: fd 3 setting O_NONBLOCK debug3: put_host_port: [localhost]:2200 debug3: load_hostkeys: loading entries for host "[localhost]:2200" from file "/home/chulhyun/.ssh/known_hosts" debug3: load_hostkeys: found key type RSA in file /home/chulhyun/.ssh/known_hosts:2 debug3: load_hostkeys: loaded 1 keys debug3: order_hostkeyalgs: prefer hostkeyalgs: [email protected],[email protected],ssh-rsa debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug2: kex_parse_kexinit: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 debug2: kex_parse_kexinit: [email protected],[email protected],ssh-rsa,[email protected],[email protected],[email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-dss debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected] debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected] debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96 debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96 debug2: kex_parse_kexinit: none,[email protected],zlib debug2: kex_parse_kexinit: none,[email protected],zlib debug2: kex_parse_kexinit: debug2: kex_parse_kexinit: debug2: kex_parse_kexinit: first_kex_follows 0 debug2: kex_parse_kexinit: reserved 0 debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 debug2: kex_parse_kexinit: ssh-rsa,ssh-dss debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected] debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected] debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96 debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96 debug2: kex_parse_kexinit: none,[email protected] debug2: kex_parse_kexinit: none,[email protected] debug2: kex_parse_kexinit: debug2: kex_parse_kexinit: debug2: kex_parse_kexinit: first_kex_follows 0 debug2: kex_parse_kexinit: reserved 0 debug2: mac_setup: found hmac-md5 debug1: kex: server->client aes128-ctr hmac-md5 none debug2: mac_setup: found hmac-md5 debug1: kex: client->server aes128-ctr hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug2: dh_gen_key: priv key bits set: 130/256 debug2: bits set: 501/1024 debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: Server host key: RSA 0a:2c:c5:31:6e:46:76:f6:e2:fb:3e:ac:77:96:36:2a debug3: put_host_port: [127.0.0.1]:2200 debug3: put_host_port: [localhost]:2200 debug3: load_hostkeys: loading entries for host "[localhost]:2200" from file "/home/chulhyun/.ssh/known_hosts" debug3: load_hostkeys: found key type RSA in file /home/chulhyun/.ssh/known_hosts:2 debug3: load_hostkeys: loaded 1 keys debug1: Host '[localhost]:2200' is known and matches the RSA host key. debug1: Found key in /home/chulhyun/.ssh/known_hosts:2 debug2: bits set: 518/1024 debug1: ssh_rsa_verify: signature correct debug2: kex_derive_keys debug2: set_newkeys: mode 1 debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug2: set_newkeys: mode 0 debug1: SSH2_MSG_NEWKEYS received debug1: Roaming not allowed by server debug1: SSH2_MSG_SERVICE_REQUEST sent debug2: service_accept: ssh-userauth debug1: SSH2_MSG_SERVICE_ACCEPT received debug2: key: /home/chulhyun/.ssh/id_rsa ((nil)) debug2: key: /home/chulhyun/.ssh/id_dsa ((nil)) debug2: key: /home/chulhyun/.ssh/id_ecdsa ((nil)) debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password debug3: start over, passed a different list publickey,gssapi-keyex,gssapi-with-mic,password debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password debug3: authmethod_lookup gssapi-keyex debug3: remaining preferred: gssapi-with-mic,publickey,keyboard-interactive,password debug3: authmethod_is_enabled gssapi-keyex debug1: Next authentication method: gssapi-keyex debug1: No valid Key exchange context debug2: we did not send a packet, disable method debug3: authmethod_lookup gssapi-with-mic debug3: remaining preferred: publickey,keyboard-interactive,password debug3: authmethod_is_enabled gssapi-with-mic debug1: Next authentication method: gssapi-with-mic debug1: Unspecified GSS failure. Minor code may provide more information Credentials cache file '/tmp/krb5cc_1000' not found debug1: Unspecified GSS failure. Minor code may provide more information Credentials cache file '/tmp/krb5cc_1000' not found debug1: Unspecified GSS failure. Minor code may provide more information debug1: Unspecified GSS failure. Minor code may provide more information Credentials cache file '/tmp/krb5cc_1000' not found debug2: we did not send a packet, disable method debug3: authmethod_lookup publickey debug3: remaining preferred: keyboard-interactive,password debug3: authmethod_is_enabled publickey debug1: Next authentication method: publickey debug1: Trying private key: /home/chulhyun/.ssh/id_rsa debug1: read PEM private key done: type RSA debug3: sign_and_send_pubkey: RSA 69:f0:21:fa:39:b5:5e:79:48:25:4d:b2:dc:59:86:23 debug2: we sent a publickey packet, wait for reply debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password debug1: Trying private key: /home/chulhyun/.ssh/id_dsa debug3: no such identity: /home/chulhyun/.ssh/id_dsa debug1: Trying private key: /home/chulhyun/.ssh/id_ecdsa debug3: no such identity: /home/chulhyun/.ssh/id_ecdsa debug2: we did not send a packet, disable method debug3: authmethod_lookup password debug3: remaining preferred: ,password debug3: authmethod_is_enabled password debug1: Next authentication method: password chulhyun@localhost's password: debug3: packet_send2: adding 64 (len 59 padlen 5 extra_pad 64) debug2: we sent a password packet, wait for reply debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password Permission denied, please try again.
This is an answer that I finally reach after the discussion made in the comments. From the comments, I realized that connecting to port 2200 is in fact an attempt to log in to the remote destination server. Based on this discovery, not only was I typing in the wrong password, but also, I was trying to log in with the wrong username. The username that I have in the destination server is 'kwagjj' so obviously, trying chulhyun@localhost was totally wrong. So I tried ssh kwagjj@localhost -p 2200 and with the password to the kwagjj account that I have at the destination server and I succeeded to get in. The point is, when utilizing the local port that you have forwarded, treat it as if you're facing the remote server at the very end of that local port.
Linux can't recognize the right password when ssh'ing?
1,383,934,307,000
When logging in to my PC, and the password is correct, the login takes place nearly instantaneously. When the password is wrong, it takes a few seconds of waiting until the hint "The password is not correct." shows up. The same thing happens on the terminal with sudo. But why? I am pretty sure that the passwords hashes are saved and get compared to the hashes of entered passwords. But wouldn't it take longer to confirm the hashes are identical?
Password failures have an intentional delay introduced in a attempt to make password cracking a slow process. If a failure replied as quickly as a success, then a dictionary attack would finish in no time at all.
Why does it take more time for a login to fail than to succeed? [duplicate]
1,383,934,307,000
My understanding is that the last change date(in /etc/shadow) is the number of days since 01/01/1970 that the password was changed, but I'm seeing numbers like 19708 which translate to 17/12/2023 (future). How is it so?
Your understanding is correct, at least on Linux. And I've confirmed that my accounts show sane dates. Two possibilities come to mind: You—or a prior admin—used chage -d (or direct editing) to change the expire date. Possibly this was done to prevent password expiration, by making the last change date (and thus expiry date) in the distant future. (Why admin didn't use chage -M, I can't say) As cjm said, the password was changed when the clock was set very wrong. Somewhat unlikely, as wrong clocks seem to be in the past more often than the future. (Because a BIOS battery dies, and sets the clock to the minimum date the BIOS authors thought reasonable.)
Unix last password change date
1,383,934,307,000
I can check that the user is expired or not with: lsuser -f USERNAME | fgrep expires But how can I check that the user's password is expired or not? Are there any other "expiring" things that can cause trouble? [so that user can't login, because he can only reach a server through FTP and his password expired, and he can't change it, because he hasn't got SSH access to give out the "passwd" command to update his password.]
Is there any chage sort of command on AIX? check /etc/shadow file thats where the expiry information is stored. Update: It seems there is a passwdexpired subroutine that can be loaded and Checks the user's password to determine if it has expired. However, it seems to be used as root. http://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=%2Fcom.ibm.aix.basetechref%2Fdoc%2Fbasetrf1%2Fpasswdexpired.htm This link has excellent documentation of what you would require http://www.torontoaix.com/scripting/when_pwd_exp As demonstrated earlier in the above article, the expiry of a password is governed by the maxage attribute. For example: maxage=0 means never to expire maxage=2 means will expire in two weeks. AIX stores the time in the epoch format in seconds, so first you must determine how many seconds in a week, as this is how maxage measures the time between password expiry, that is in week numbers. There are 86400 seconds in a day, so multiplying that by seven comes in at 604800. So there are 604800 seconds in a week. The next command you need to look at is the pwdadm, which in turn queries the file /etc/security/passwd. This file holds the values in seconds when a user last changed their password. Interrogating the file or using the pwdadm command will return the same result. For this demonstration, let us query the user spoll: # grep -p "spoll:" /etc/security/passwd spoll: password = EvqNjMMwJzXnc lastupdate = 1274003127 flags = ADMCHG # pwdadm -q spoll spoll: lastupdate = 1274003127 flags = ADMCHG You can see the lastupdate value in seconds from the above output. In other words, the last time the password was changed: 1274003127 Next, using the lsuser or interrogating the file with /etc/security/user, you can determine the number of weeks before the user spoll password will expire: # grep -p "spoll:" /etc/security/user spoll: admin = false maxage = 4 # lsuser -a maxage spoll spoll maxage=4 You can see from the above output that the number of weeks before password expiry is 4. The next task is then to multiply the number of seconds in a week by the number of weeks before the user spoll password is due to expire. In this case, it is 4: 604800 * 4 # expr 604800 \* 4 2419200 Next, you need to add the maxage value in seconds (604800 * 4) to the last time the password was changed: 2419200 + 1274003127 # expr 2419200 + 1274003127 1276422327 You can now convert that number of seconds from UNIX epoch into a more meaningful current time presentation. You can use different tools, but for this demonstration you'll use gawk with the strftime function: # gawk 'BEGIN {print strftime("%c",'1276422327')}' Sun Jun 13 10:45:27 BST 2010 The above calculation gives the time of the next password expiry. So, you now know that user spoll's password was last changed on ( from the pwdadm command): # gawk 'BEGIN {print strftime("%c",'1274003127')}' Sun May 16 10:45:27 BST 2010 And that it will expire on: Sun Jun 13 10:45:27 BST 2010 ------------------Perl script-let-------- #!/bin/perl use POSIX qw(strftime); $maxage=4; $last_update = 1274003127 $max_week_seconds = 86400 * $maxage; print strftime("%C ", localtime($max_week_seconds));
How to check that a user/password is expired in AIX?
1,383,934,307,000
I am executing a command in TCSH, which requires me to pass a password on the command line. Obviously, I would like it not to be saved in the history file. I know that other shells like Bash supports various ways to achieve it, like export HISTCONTROL=ignorespace. Is there anything similar for TCSH (preferably on FreeBSD)?
TCSH does not support anything like this. The whole history of a shell session is merged to the history file when the shell is closed. It is possible to skip a command from being added to the history file, however, by spawning another TCSH shell and unsetting savehist: beastie@freebsd:~ $ csh beastie@freebsd:~ $ echo First shell: $$ First shell: 7143 beastie@freebsd:~ $ exit beastie@freebsd:~ $ tail -n 1 ~/.history echo First shell: $$ beastie@freebsd:~ $ csh beastie@freebsd:~ $ unset savehist beastie@freebsd:~ $ echo Second shell: $$ Second shell: 74821 beastie@freebsd:~ $ exit beastie@freebsd:~ $ tail -n 1 ~/.history echo First shell: $$ As you can see, the command of the second shell were not appended to the history file.
Is there a way to disable history for one command in TCSH?
1,383,934,307,000
Is there any command or way to remove all entries from history of bash shell containing a particular string? this will be useful to remove commands in history containing password. I know we can remove each history entry by its number but the issue is it deletes only one entry at a time and I need to take out number each time to remove a new entry. eg. History command shows 5 entries containing password abcabc and I want to remove all the entries from history command containing string abcabc 975 2019-03-15 11:20:30 ll 976 2019-03-15 11:20:33 ll cd 977 2019-03-15 11:20:36 ll CD 978 2019-03-15 11:20:45 chown test1:test1 CD 979 2019-03-15 11:20:53 chown test1:test1 ./CD 980 2019-03-15 11:20:57 chown test1:test1 .\CD 981 2019-03-15 11:22:04 cd /tmp/logs/ 982 2019-06-07 10:36:33 su test1 983 2019-08-22 08:35:10 su user1 984 2019-08-22 08:35:15 /opt/abc/legacy.exe -password abcabc 985 2019-09-24 07:20:45 cd /opt/test1/v6r2017x 986 2019-09-24 07:20:46 ll 987 2019-09-24 07:21:18 cd /tmp/ 988 2019-09-24 07:21:19 ll 989 2019-09-24 07:21:24 cd linux_a64/ 990 2019-09-24 07:21:25 /opt/abc/legacy.exe -password abcabc 991 2019-09-24 07:24:03 cd build/ 992 2019-09-24 07:24:04 ll 993 2019-09-24 07:24:07 cd .. 994 2019-09-24 07:24:10 /opt/abc/legacy.exe -password abcabc 995 2019-09-24 07:24:15 cd someapp/bin 996 2019-09-24 07:24:21 ll 997 2019-09-24 07:24:33 cd . 998 2019-09-24 07:24:35 cd .. 999 2019-09-24 07:24:36 ll Tried following command which gave error as given below servername:~ # sed -i 'g/abcabc/d' /home/user1/.bash_history sed: -e expression #1, char 2: extra characters after command Expectation : No error and all the entries containing string abcabc should be removed.
you could use sed to remove entries from .bash_history. But as it's a password to avoid typing the password again in the CLI I would advise you to edit your .bashrc file and insure that the line with HISTCONTROL is set to ignoreboth or ignorespace. This would allow you to type command in bash and not put them in history if they start by a space: promtpt:$ sed -i '/abcabc/d' /home/user/.bash_history Notice the space between $ and the command this would make the line ignored in bash history. -i: means edit file inline. d in the end mean remove line containing expression between /. This solution only works on Linux GNU sed.
How to remove all entries containing particular string from history command in BASH?
1,383,934,307,000
Recently, we've rebooted server and got ecryptfs mount fail: ... Signature not found in user keyring Perhaps try the interactive 'ecryptfs-mount-private' user@host:~$ Could that be because of password change? Although, 1. There's no mount password 2. We might have login password When trying to recover mount directory, it outputs: user@host:~$ ls Access-Your-Private-Data.desktop README.txt user@host:~$ ecryptfs-mount-private Enter your login passphrase: Error: Unwrapping passphrase and inserting into the user session keyring failed [-5] Info: Check the system log for more information from libecryptfs ERROR: Your passphrase is incorrect Enter your login passphrase: user@host:~$ sudo ecryptfs-mount-private [sudo] password for user: Enter your login passphrase: Inserted auth tok with sig [ad21fabcda6abfeab] into the user session keyring fopen: No such file or directory user@host:~$ So, as you can see, it shows such strange error: fopen: No such file or directory and, also, when running ecryptfs-mount-private without sudo - it fails. When mounting folder using ecrypts-recover-private and login password it mounts it in temporary folder like a charm. Also, we've tried to ecryptfs-rewrap-password and it doesn't work without sudo. So, using sudo ecryptfs-rewrap-password succeeded in rewrapping, but after reboot the same situation persists. All in all, what could this be; how to fix this auto mount encrypted home directory at login?
I set up an ecryptfs private folder, then removed the r & w permission from the wrapped-passphrase file to test... If you had checked the syslog right after seeing the message Info: Check the system log for more information from libecryptfs You would have seen lines like this: Jan 15 00:21:48 sys ecryptfs-insert-wrapped-passphrase-into-keyring: Failed to detect wrapped passphrase version: Permission denied Jan 15 00:21:48 sys ecryptfs-insert-wrapped-passphrase-into-keyring: Error attempting to unwrap passphrase from file [/home/user/.ecryptfs/wrapped-passphrase]; rc = [-13] Together those would be a pretty strong arrow pointing to check the permissions of the ~/.ecryptfs/wrapped-passphrase file. (No sudo or strace required) All in all, just make sure you're running ecryptfs-mount-private command as same user's directory you're trying to mount and wrapped-passphrase file has -rw------- or (600) permissions and same owner as encrypted directory.
"ecryptfs-mount-private" returns "fopen: No such file or directory"
1,383,934,307,000
I've just installed Synaptic and Gparted on my Raspbian Lite. However I can't use them when launching from the desktop. They ask me for the root password which... there isn't. I have no problem launching them from a terminal using sudo but seems a bit stupid having to use a command to launch a GUI application when they have a perfectly fine GUI executable. What can I do so they ask me for my password instead of root's? EDIT: Finally, what I've have done in order to avoid having the root account enabled is editing the .desktop files. sudo nano /usr/share/applications/synaptic.desktop And changed the line that says: Exec=synaptic-pkexec to: Exec=sudo synaptic-pkexec Now it doesn't ask for password if the user has sudo privileges.
Gparted attempts to elevate itself when it starts via polkit, which prompts you for some authentication through whatever polkit agent you're using It seems Synaptic also uses polkit Your options are: Add yourself to the wheel group with $ sudo usermod -aG wheel [user] log out and in again polkit should now ask for you own password Change the way polkit behaves, eg no authentication, or other options Set the root password via $ sudo passwd root, to your own user's password perhaps you might have to first unlock the root user through $ sudo passwd -u root
Gparted and Synaptic ask for root password instead of mine
1,383,934,307,000
I'm trying to reverse engineering an IP camera firmware and found the complete ROM OS but I would like to find out the system password so I have looked at /etc/passwd. The file is not there, it is instead in /etc/default/passwd and here is its content: # cat passwd admin:hgZXuon0A2DxN:0:0:Administrator:/etc/config:/bin/sh viewer::1:1:Viewer:/:/dev/null So now I am searching for the shadow file and there is such file in the complete ROM? So I'm a bit confused here what is the encryption type used on this system? Btw I want to learn on how to do it not just lookup a password table (btw it would work on the web ui but not on telnet) and every tutorial seems to use this type of hash: root:$6$jcs.3tzd$aIZHimcDCgr6rhXaaHKYtogVYgrTak8I/EwpUSKrf8cbSczJ3E7TBqqPJN2Xb.8UgKbKyuaqb78bJ8lTWVEP7/:0:0:root:/root:/bin/bash Not the one I have
In that form (that is before /etc/shadow and without any $...$ prefix) it is probably (3)DES based hashing, see https://en.wikipedia.org/wiki/Crypt_%28C%29#Traditional_DES-based_scheme and the table above that paragraph: The original password encryption scheme was found to be too fast and thus subject to brute force enumeration of the most likely passwords.[10] In Seventh Edition Unix,[12] the scheme was changed to a modified form of the DES algorithm If you use this tool https://github.com/psypanda/hashID it says on your value: Analyzing 'hgZXuon0A2DxN' [+] DES(Unix) [+] Traditional DES [+] DEScrypt A brute forcing tool like hashcat should be able to find the original password based on that. It also tells you for your specific hash that the hash value is wrong (for this reason: https://hashcat.net/forum/thread-3809.html) in which case, if this is really a hash it is probably instead hgZXuon0A2DxM. Note an interesting "feature" of this kind of password storage (if it is truely ancient DES-based Unix storage): only the first 8 bytes (hence characters because then UTF-8 was unheard of) are taken into account, so that limits the space of possible values.
Reverse engineering IP camera firmware to find admin password
1,383,934,307,000
I have my local machine (a mac), and I want to access server B (linux). Server B needs to be accessed through server A (linux). I have set up a tunnel by modifying the .ssh/config file in my local machine as follows: Host serverB HostName serverB.com User Ant ProxyCommand ssh -q -Y serverA.com -W %h:%p This used to work correctly[0]. Next, I set up passwordless login from local to serverA and from serverA to serverB using ssh keys. This means that I can do > ssh [email protected] (serverA)> ssh [email protected] (serverB)> and everything works properly. Now what I want is to be able to connect to server B without passwords; but if I do > ssh [email protected] I am asked the passwords to severA and B to keep going. This is the output of ssh -v Ant@serverB: OpenSSH_7.6p1, LibreSSL 2.6.2 debug1: Reading configuration data /Users/Ant/.ssh/config debug1: /Users/Ant/.ssh/config line 16: Applying options for serverB debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 48: Applying options for * debug1: Executing proxy command: exec ssh -q -Y serverA.com -W serverB.com:22 debug1: identity file /Users/Ant/.ssh/id_rsa type 0 debug1: key_load_public: No such file or directory debug1: identity file /Users/Ant/.ssh/id_rsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/Ant/.ssh/id_dsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/Ant/.ssh/id_dsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/Ant/.ssh/id_ecdsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/Ant/.ssh/id_ecdsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/Ant/.ssh/id_ed25519 type -1 debug1: key_load_public: No such file or directory debug1: identity file /Users/Ant/.ssh/id_ed25519-cert type -1 debug1: Local version string SSH-2.0-OpenSSH_7.6 debug1: permanently_drop_suid: 501 [email protected]'s password: I can see that it is trying to use the key login but something is going wrong. Let me also add that my RSA key is saved into a non-standard location, so I added this to my .ssh/config file: IdentityFile ~/.ssh/key_serverA Any thoughts? [0]: For some reason this does not work anymore, as the username is wrong. It prompts me for my password at [email protected] rather than [email protected]
The User option in a Host section is only applied for connections matching that host, and not necessarily for any commands started for proxying, etc., for which ssh config settings will be independently applied. So either the ProxyCommand should explicitly have Ant@serverA, or there should be another Host block that serverA matches, setting User Ant for it.
Passwordless ssh tunnel
1,383,934,307,000
I use the following /etc/crontab code to create daily backups of my database in limit of the last 30 days: 0 8 * * * mysqldump -u root -PASSWORD --all-databases > /root/backups/mysql/db.sql 1 8 * * * zip /root/backups/mysql/db-$(date +\%F-\%T-).sql.zip /root/backups/mysql/db.sql 2 8 * * * rm /root/backups/mysql/db.sql 2 8 * * * find /root/backups/mysql/* -mtime +30 -exec rm {} \; My problem: I must put my password where -PASSWORD. This way my password is exposed if by mistake I entered to change something in this file and someone near to me saw it. Is it possible to use the script without putting the password there? Alternatively, do you know a similar syntax that won't force me to write the password there for a cronjob?
Create a script to do the complete dump, backup and cleanup. Schedule the script. Additionally, the password to mysql may also be stored in a protected file and does not need to be given on the command line. MySQL has a "End-User Guidelines for Password Security" document that you may want to consult. To summarize that document: Create .my.cnf in your home directory and add the password to it like this: [client] password=your_pass Then remove read-permissions on the file for other users: $ chmod 600 .my.cnf or, equivalently, $ chmod u=rw,go-rwx .my.cnf This file, if named .my.cnf and placed in you home directory, will automatically be used by the mysql client program (as well as by mysqldump). Still, do put the backup etc. into its own script and schedule that instead. That will be a whole lot easier to maintain than a number of cron jobs.
Making a cron-scheduled database backup (dump) without exposing the password in /etc/crontab
1,383,934,307,000
I'm quite new in the linux world. I've got a file containing Usernames and Passwords, for browser authentications. eg.: user:ioeuwz5rf (Password generated with "openssl passwd ABCXYZ") Now, I want these passwords to get changed automatically every week or whatever. I tried it with a change.sh file containing: newpw="`openssl passwd ABCXYZ`" sed -i 's/WhatToReplace/'$newpw'/g' test.txt This would replace the word "WhatToReplace" with the generated pw. But I want to do it automatically. Is there a way to replace the 2nd part (user:ioeuwz5rf) with the random password. I want a new random password generated for every user, and this should be saved into a file (newpw.txt eg.) from which I can generate mails.
Instead of replacing all lines in newpw.txt, it would be better to create a new file by iterating over the usernames in the old one, for example: cut -d: -f1 pw.txt | while read -r user; do echo "$user:$(openssl passwd ABCXYZ)" done > newpw.txt mv newpw.txt pw.txt
Replace parts of files
1,383,934,307,000
I want to grep the users (first column) from the /etc/passwd file and assign them a password. I only want to do this for user accounts and not default system accounts. So far I have a simple bash script #!/bin/bash touch /usertempfile grep "/home" /etc/passwd |grep -v "/bin/false"|grep -v "/sbin/nologin"|grep -v $USER |awk -F":" '{print $1}' >> /userstempfile for i in $(cat /usertempfile); do echo -e "password/npassword" |passwd $i done rm -rf /usertempfile The script is able to extract the users from the /etc/passwd file that are not a default system account but is unable to change the passwords of the users which are in that file. What am I doing incorrectly?
I am using chpasswd in my script and it's working fine for me: echo "$USERNAME:$NEWPASSWORD" | chpasswd PS: for not root user use sudo before chpasswd echo "$USERNAME:$NEWPASSWORD" | sudo chpasswd
Assign a random password to all existing users
1,383,934,307,000
How to configure a user (in Debian) to login without password? A user without password needs to login in physical terminals (ttys - not pty) either using su - user from another user, without being asked for password. (security isn't a requirement in this environment)
Ensuring that the file /etc/pam.d/common-auth has only module args nullok instead of nullok_secure, allows users to login without password when the user doesn't have any password set.
Passwordless login (from physical console and from others users)
1,383,934,307,000
I'm learning about encryption and decryption on linux and php. So I have three questions about openssl and how it generates password hashes. 1- So say I generated a password with the linux command openssl passwd My first observation is that every time I generate a hash, it's different! Why is that? Is it because of salt? That's my first question. 2- Now my second question is about testing this password. Say I want to test the correctness of this password and get a binary answer, whether it's correct or not. How do I do that with openssl? If my question doesn't make sense, then how is openssl passwd useful? 3- If I encrypt my password with a hash using openssl passwd, and every time there's a random salt added to it, how does openssl decrypt it (or any other program for that matter)? Thank you.
openssl crypt you password with an algorithm and a salt. If you do not provided a salt an random is choosen. the salt is given in the resulting hash. for instance openssl passwd -1 foo $1$pyuddMjp$3.deTnHdrVVVLoh5zkQ0B. where 1 is proticol (md5 here) pyuddMjp is salt If I want to verif you know passwd (i.e. foo), I need to compare resulting hash, using passwd option with salt. with x=bar openssl passwd -1 -salt pyuddMjp $x $1$pyuddMjp$kNkQHWoF8WVh7Oxvae5YX1 with x=foo openssl passwd -1 -salt pyuddMjp $x $1$pyuddMjp$3.deTnHdrVVVLoh5zkQ0B.
How does openssl decrypt a password
1,383,934,307,000
If my computer has the pam package installed and has the directory /etc/pam.d/sshd, does it mean for sure when I ssh to my computer, I am authenticated through pam modules? The /etc/pam.d/sshd looks like this: #%PAM-1.0 auth include system-auth account required pam_nologin.so account include system-auth password include system-auth session optional pam_keyinit.so force revoke session include system-auth session required pam_loginuid.so
Technically the default is that sshd does not use PAM. From the sshd_config manpage: UsePAM Enables the Pluggable Authentication Module interface. [...] The default is ``no'' But this option is almost universally enabled by SSH installations by OS distributions and default config files and such. You can check if it's enabled in /etc/ssh/sshd_config if you want to be sure though. However, even when PAM is in use by sshd, you can still be authenticated with an SSH key, which bypasses the PAM authentication part (PAM accounting and session management are still done).
Howto Tell if a System authenticate with password only or through PAM
1,383,934,307,000
On some embedded linux systems, there is no /etc/passwd file and /etc directory is not writable (which means I cannot set user account and password?). Then what is my (default) account name and password, or how to set account and password? I need to get account and password on embedded linux to run ssh server, which requires user account and password for ssh login.
If there is no /etc/passwd, then your embedded system is not running what is usually known as the Linux system, but rather a different operating system which is also based on the Linux kernel. A famous example of an operating system which uses on the Linux kernel but is not Linux is Android. Android doesn't have user accounts (at least not in its basic usage) and repurposes users to isolate applications rather than accounts. Such embedded systems are generally not meant to have user accounts. They have at most a control console, which is solely intended for administration and allows running commands as root. There may be authentication in some form, or the fact that you have physical access may be considered sufficient authentication. There's no general rule there, you have to know (or find out) how your system is designed. If you want to connect with SSH, you'll have to supply credentials to the SSH servers.
How to check my account on embedded linux without "/etc/passwd"?
1,383,934,307,000
Is there some way to make su ask for the password again in case of a wrong password (just as sudo does)? Initially I thought of this: while ! su -c foo; do read -n 1 -p "Retry(y/n)?" ch if [[ "$ch" != "y" ]]; then break fi done But foo returns 1 in some cases as well, making it impossible to detect whether a wrong password was entered or if foo failed.
As a workaround, I would suggest the following: #!/bin/bash while ! su -c "foo; exit 0"; do read -n 1 -p "Retry? (y/n) " ch [[ "$ch" != "y" ]] && break # This does the same in fewer lines done This returns a zero value even if foo has a different exit code. WARNING: using this workaround (which is a bit ugly), you won't be able to determine foo's exit code. I don't know if it is required for your project.
Making su ask for password multiple times
1,364,557,534,000
Suppose I have access to pc via a server. I can directly log-on to pc by using How do I connect to a pc through another pc using ssh Such that my .ssh/config looks like: Host short Hostname pc User me ProxyCommand ssh me@server nc %h %p The user and home-folder on pc and server are the same, but only server can be directly reached from the outside world. Now, if I ssh short, I have to type the same password twice. I am now looking for a way to login using the tunnel without typing my password even once. I've tried the ssh-keygen procedure, but that does not help me here. I also found this quite related question: Set up password-less SSH tunneling from home computer behind NAT to inside computer behind gateway, but I can't figure out how this would apply to my situation. The question basically comes down to: how can I setup passwordless login over a ssh alias?
You need to set up key authentication on both machines, both the rebound machine (server) and the target machine (pc). Create a key pair on your client machine (ssh-keygen) if you haven't already done so. Then copy the public key to server and add it to the authorization list. Then do the same thing for pc. ssh-copy-id server ssh-copy-id short To avoid having to type your passphrase twice, run a key agent. Many systems are set up to run one when you log in: check if the SSH_AUTH_SOCK environment variable is set. If it isn't, run ssh-agent as part of your session startup. Before you start using ssh in a login session, record your passphrase in the agent by running ssh-add ~/.ssh/id_rsa.
How to password-less log on via ssh alias
1,364,557,534,000
Apparently, I can find out whether a Samba user needs a password change or not with the following command: pdbedit -v -u userid | grep "Password must change" I also see I can list all the Samba users with the command: pdbedit -L -v Which outputs about 10MB of data formatted like this: --------------- Unix username: egbjt005$ NT username: egbjt005$ ... Password must change: Thu, 16 Aug 2012 07:33:58 NZST ... --------------- Unix username: eghwj001$ NT username: eghwj001$ ... Password must change: Fri, 20 Jul 2012 14:42:46 NZST ... The ... indicates several lines of data that's not of interest. The date will be in the past if the password is overdue to be changed. What I really want is a list of userids starting with a particular 2 character prefix (let's use "eg" as an example) that need a password change. How can I do this?
I'm going on some examples of pdbedit output I found online. Yours might differ; if you can provide some examples of what it prints, this code can be more tailored to what you need. First, you need to find the usernames that match your prefix. It seems that pdbedit output is in username: foo format, so you could use awk to do that: pdbedit -L -v | awk '/username:/ {print $2}' Then we need to find names that start with your prefix, so let's use grep: pdbedit -L -v | awk '/username:/ {print $2}' | grep ^eg To see if a particular user's password needs to change, we can just see whether grep found that string, by checking its return code: if pdbedit -v -u $name | grep -q "Password must change" ; then echo $name fi Putting it all together with a loop that checks each name: for name in $(pdbedit -L -v | awk '/username:/ {print $2}' | grep ^eg); do if pdbedit -v -u $name | grep -q "Password must change" ; then echo $name fi done Update after you posted sample output That format is clearly not designed by someone who's a fan of normal Unix command-line text processing tools! While you can, of course, do anything in any language, I'd probably move to something like Python or Perl to parse this one. I chose Perl here because Python's handling of dates and times is abysmal. #!/usr/bin/perl use Date::Parse; $now = time(); while (<>) { if (/Unix username:\s*(.*)/) { $username = $1; } if (/Password must change:\s*(.*)/) { $change = str2time($1); if ($change <= $now) { print "$username\n"; } } } This will print the Unix username of any user whose password is expired. Use it like: pdbedit -L -v | perl parse.pl Edit by Question author The final code I used was: #!/usr/bin/perl use Date::Parse; $now = time(); while (<>) { if (/Unix username:\s*(.*)/) { $username = $1; } if (/Password must change:\s*(.*)/) { $expiry = $1; $change = str2time($expiry); if ($expiry !~ /^never/ && $change <= $now && $username =~ /^eg[a-z]{3}\d+/) { print "$username expiry: $expiry\n"; } } } Which produces output like this: egdfd001 expiry: Mon, 30 Jul 2012 08:12:02 NZST egjpf001 expiry: Mon, 13 Aug 2012 07:50:03 NZST
How to list and filter Samba users that need a password change?
1,364,557,534,000
When I want to compare a local file with a remote file, any of these usually works: $ ssh remote cat file | diff file - $ diff file <(ssh remote cat file) However, sometimes (especially when the password is needed) they fail like this: $ ssh remote cat file | diff file - 1,162d0 < ... < ... Password: Here, diff doesn't wait for ssh to complete and considers the second file empty. It is only after diff is finished that ssh asks for the password, but it is too late. $ diff file <(ssh remote cat file) Password: Password: # asking again after a few seconds #&%Pasword: # the typed raw password leaks into the terminal user@remote's password: Permission denied, please try again. user@remote's password: Permission denied, please try again. user@remote's password: Received disconnect from XXX.XX.XX.XX: 2: Too many authentication failures for user 1,162d0 < ... < ... This time, ssh asks for the password, but the typed password is echoed back to the terminal, and ssh doesn't get it. Finally, ssh fails and diff continues with an empty second file. Can you explain why these are happening, or what's happening in detail under the hood?
When you run ssh first: ssh remote 'cat file' | cat ssh gets your controlling terminal as stdin, so you can type your password in with no problems. When you use bash's process substitution, stdin remains connected to the first command, and the subprocess's output pipe gets passed to the first command as an argument: cat <(ssh remote 'cat file') If the ssh negotiation succeeded, /dev/fd/63 will be a pipe containing the output of ssh remote 'cat file'. This can be demonstrated with the following command: $ echo <(ls) /dev/fd/63 The important part of this is that your terminal is connected to cat's stdin, not ssh's. When this runs, cat gets a command-line argument like /dev/fd/63. Therefore, cat ignores stdin altogether; however, it is still connected to the cat process, and not ssh, so your password goes nowhere. If you want to change this, you will need to run ssh first, and pipe the output to diff, as you have already demonstrated above: ssh remote 'cat file' | diff file -
password problem when feeding a remote file into diff
1,364,557,534,000
I'm using busybox with a limited passwd (I don't have --stdin option) and without chpasswd and I need to change the password of an user from bash. Here is my best result: echo newpassword > pwdfile echo newpassword > pwdfile cat pwdfile | passwd myuser Changing password for myuser Enter the new password (minimum of 5, maximum of 8 characters) Please use a combination of upper and lower case letters and numbers. Enter new password: Bad password: too simple. Warning: weak password (continuing). Re-enter new password: passwd: The password for myuser is unchanged.
Busybox has chpasswd(8) which is a utility best used to create/update a lot of users very quickly and with one command. It accepts data from STDIN in username:password form. That means that you can do something like this: $ cat pwdfile | chpasswd or $ < pwdfile chpasswd Note that pwdfile must have username:new_password syntax. Then again, you could always edit /etc/shadow yourself -- but please don't.
How to set a new password from bash?
1,364,557,534,000
I have been using pass for some time to store passwords, but now I want to move my password store from the default location. According to the man page, it is enough to set PASSWORD_STORE_DIR variable to the desired path to override the default one, however in my case this has no effect. After I move the .password-store folder to a new location and set the environment variable, executing the command pass results in "Error: password store is empty. Try "pass init".". Even if simply renaming the .password-store inside home directory: $ cd $ mv .password-store .pass $ PASSWORD_STORE_DIR=/home/bakhtin/.pass #bakhtin is the user name $ pass Error: password store is empty. Try "pass init". Any ideas on what the problem might be? I made sure the are no spelling errors in the variable's name and such.
Since the variable and its value need to be accessed by pass, a process started from the shell and running separately from it, the variable needs to be an environment variable. Environment variables are inherited by child processes, but other shell variables are not inherited. In your case, you have simply forgotten to use export on the PASSWORD_STORE_DIR variable to tag it as an environment variable. export PASSWORD_STORE_DIR=~bakhtin/.pass You may also use just export PASSWORD_STORE_DIR to mark the variable as an environment variable if you have already assigned a value to it. Another way to pass the variable into the environment of pass without even creating it as a shell variable in the invoking shell is to write the assignment in front of the invocation of pass: PASSWORD_STORE_DIR=~bakhtin/.pass pass This sets the variable's value for the pass process but does not create a variable in the current shell.
PASS Password store: Environment variable has no effect on password store location
1,364,557,534,000
I am checking to see if the minimum password history setting is set to 6. Using the command below, I am able to check the default stanza: lssec -f /etc/security/user -s default -a histsize Can this command be enhanced to view all user settings to ensure it is set to 6?
Since lssec's -s option only accepts the string "default" or one specific user, use lsuser to list every user and their histsize attribute, then use awk to look for values other than 6: lsuser -C -a histsize ALL | awk -F: 'NR > 1 && $2 != 6' The "NR > 1" portion skips the header line; the default action is to print the entire line, which would show the username and their histsize attribute.
AIX 7 - Command To Check Histsize Is Set Correctly For All Users
1,364,557,534,000
Let's suppose a scenario of a Unix-like system (like macOs, linux, solaris etc.) having installed a program from the internet that's been developed by a malicious actor. The program does not use any zero day exploits on the system to escalate privileges. It simply runs within the context of a regular non-administrative user, with all its restrictions. It records all keypresses in the background until it records the user typing into a terminal "su" followed by a password. This program, suddenly, captures the password of the root user. My question is, having this password captured, can the program relaunch itself from the context of the root user or even escalate its privileges while still running, doing all this without the current user noticing? What utilities do exist that will allow such a program to do such a thing? I'm talking about an ideal scenario in which no bugs or exploits in the kernel are used whatsoever. I'm simply talking about a program simply using existing system utilities in ways that they were already intended to be used.
Yes. By execing su. su is a program to allow the change of user with a password. su has the capability of changing user, and will do it only if you provide the correct password. However the only way to do this is to start a new process, or replace the program of the existing process. It could then re-launch it self with the new privileges. Pedantic note: A process can escalate its privileges via su. But a program can not. However the new program (su), can relaunch the old one.
Is it possible for a process currently installed on a system to escalate its privileges by knowing root's password?
1,364,557,534,000
Using RHEL6 Within the file /etc/pam.d/system-auth I have the following setting: difok=4 However I am able to successfully change root's password from abcd1 to bbcd1 It seems like I should not be able to do this as the new password is not 4 characters different from the original. Is this expected? If it is expected, is there any way to place password complexity restrictions on the root account?
Assuming you are using pam_pwquality (it is not clear from your post, and difok appears to be used by a variety of different PAM modules per a web search) then root checks skip this test because there is no old password to compare against: enforce_for_root The module will return error on failed check even if the user changing the password is root. This option is off by default which means that just the message about the failed check is printed but root can change the password anyway. Note that root is not asked for an old password so the checks that compare the old and new password are not performed. This quote is from the pam_pwquality(8) man page on a centos7 system.
Password Complexity Issue
1,364,557,534,000
So I had this question earlier and it got answered "Terminal - Zip multiple directories into separate zip files with password" however I couldn't find out how I can use a password with special characters like !@#$. I tried the typical solutions: Enclose the whole password string in " " or ' ' / before every special character. Nothing worked. This is the command that worked for me except that the password was never set correct (in my attempts it was either set to something different from what I intended, or wasn't set all together) for i in */; do zip -r "${i%/}.zip" "$i" -p "mypassword!@#$" ; done
You are probably using "/" instead of "\", so the right solution will be like this: mypassword\!\@\#\$
Terminal - Zip files with special characters in password
1,364,557,534,000
I have a headless server (CentOS 6.7 in my case). Presumably in almost all circumstances commands issued as root should use sudo. Is it possible, and wise, to completely disable password access for root? I know this is the default policy for, say, an Ubuntu desktop box, but I'm not sure it's the right choice in most cases.
There are very few instances when you need to use a root shell for anything. In fact, the only time I find myself at an actual root shell prompt is those few times when I'm configuring a new user for myself when setting up a new system. The Ubuntu way of doing things, i.e. to lock the root account completely, is IMHO a good idea. This is not the same as having a root account with an empty password, which would be a truly terrible idea. The downside with sudo is that it's potentially difficult to configure for a novice, if anything other than "give some users full root access" is needed on a multi user system.
Should root account have password?
1,364,557,534,000
I would like a simple (ideally one-liner, without separate script file) command to connect to an ftp server via anonymous login using my email address as the password. My attempt is based on the syntax as shown here of basically ftp username:password@hostname; however this does not work for me when the password itself, being an email address, has an @ sign.. I also tried to provide a netrc file as a heredoc, as so: ftp hostname -N <<< 'login anonymous password [email protected]' but this still prompts me for a password during the ftp login..
use lftp example: lftp -u user,pass ftp.example.com
Specify anonymous ftp password in ftp command
1,364,557,534,000
I have a public key to log on to my server. This key is password protected. However, when I log in to my server, there's no indication that the key is ever used. I just log in with my password as before. What kind of messages can I expect using public key/password combined authentication? I just need to know if both are being used or if I botched the public key setup. The client is Xubuntu 14.04, the server is Ubuntu Server 14.04.
> ssh -v ... gives you output which tells you how authentication was done. This is with public key: [...] debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Offering DSA public key: /home/hl/.ssh/id_dsa_srm debug1: Server accepts key: pkalg ssh-dss blen 434 debug1: Enabling compression at level 6. debug1: Authentication succeeded (publickey). [...] That is the technical part. Usually you notice that the public key is used by having to enter the passphrase (unless you don't use one or it is cached by ssh-agent).
SSH not giving indication that the public key is being used for login
1,364,557,534,000
I'm developing an application which is distributed on a VM. The default password is always the same, but it's hash in /etc/shadow changes with every release. How can I programmatically (e.g., from a bash script) find out whether the password was changed? Checking the hash is not an option because if the password was changed to something else and back, it will be different. I also want to keep the check as simple as possible.
If you know the passwd, you can generate de md5 string with openssl passwd -salt $salt -1 foo The point is getting the value for "$salt". This can be retrieved using awk on the crypted passwd from /etc/shadow. echo $CRYPTIC | awk -F\$ '{print $3}'
How do I determine if the linux password was changed?
1,364,557,534,000
We have a copying machine that can be used as a printer. In order to do that, I have to provide a credential in plain in the Xerox.ppd file. Problem: Any user on the system can grep credential /etc/cups/ppd/Xerox.ppd no matter if CUPS allows him to use that printer. Being more restrictive on the file permissions of that file makes it impossible for users to set options like paper format and duplex/simplex, so that's no option. For example, I want lpoptions -l to keep working. Is there a way to overcome this?
In researching this it does not appear that there's a method for blocking users from accessing the contents of the PPD file. Re: Unable to Print to Networked Konica Minolta BizHub C280 Re: How do I set the default value in a PPD. (xerox accounting) Printing to Xerox with XSA accounting from Linux So without this option your only viable option to restrict access would be to lock the .ppd files down.Locking that file down so only the CUPS user can access would seem to be the way to go. $ sudo chown cupsuser:cupsgroup /etc/cups/ppd/Xerox.ppd $ chmod 600 /etc/cups/ppd/Xerox.ppd However this has caveats. Users will not be able to access this .ppd file to use this printer. Remote printers One way to get what you want would be to hide the printer behind a Samba server which should expose the options to users without exposing the permissions. Since I don't have this printer I can't fully test this out but I described a method that should be usable for you in thie Super User Q&A titled: How to set account and password in Linux for using a network printer.
Credential in PPD file: Is there a way to hide it?
1,364,557,534,000
I have Linux Mint 14 Xfce (4.10) and have also installed LXDE desktop, so I can choose between these sessions if I want. Normally I would set one as default and at startup I am not asked for username&password and am logged in automatically as intended. (Under Settings/Login Window/Security - "Enable automatic login" is checked; and have also verified that /etc/lightdm/lightdm.conf contains the line autologin-user=cipricus.) But even before installing LXDE I was asked for username and password after logout despite the fact that in Settings/Users and Groups I have the setting of not being asked for password on login. In /etc/mdm/mdm.conf I see the line: AutomaticLoginEnable=true. (Settings/Session and startup/General - 'Display session chooser' is unchecked. But this regards the other type of 'session': not the first type that involves selecting between users-passwords-desktops, but the one that involves selecting between sets of saved settings of the same user and desktop. More on this distinction/confusion here.) I find it odd that if I restart the computer I can enter default session without password, but if I just log out the username&password are needed to log in. Opening computer and entering default session/DE: no username&password selecting between sessions: username&password needed. In the future I might decide to activate password at startup but I still don't want a password being asked in order to change or re-enter a session after the system has started. Are there other settings to make?
Trying many possible combinations of settings I solved it but the conclusion is that there is something amiss with Xfce's session manager settings or GUI. What I have verified is: As stated in the question, when this problem happens, under Settings/Login Window/Security - "Enable automatic login" is checked, like so: Enable timed login is not checked. The odd thing is that in order to avoid typing username & password after logging out it is enough to check 'Enable timed login'. The login window appears but just 'Enter' is needed to start session in this case: Even with 'Enable automatic login' unchecked, typing username & password after logging out is not necessary if 'Enable timed login' is checked. That doesn't make too much sense to me, but it works. Edit after restart: Because (related to a different problem - here) "Automatically save session on logout" (Menu/Settings/Session and Startup - General tab) was disabled, the solution above was not saved after startup. So, in case session automatic saving is disabled, make the 'good' settings as in the images above and in Menu/Settings/Session and Startup - Session tab: click "Save session" button. In this way, after logout, username and password are not required to login in the default session, but are required to login into a different one. This may seem odd, considering the fact that in Settings/Session and Startup/General there is an option to 'Display chooser on login'. But checking that displays only DE-specific sessions (the ones saved within a certain DE, that is within the generic "session"). In fact it seems that passwords are asked for desktop environments, not for saved "sessions". This double meaning of "session" is confusing. There is no logic in this, this solution is just a limited workaround, there may be many other variables depending on other settings that I haven't touched yet. For example, the login experience varies even depending on the style and theme of the login window... Some of the themes may display the username as a button (if Style "Themed with faced browser" is selected under Under Settings/Login Window/Local), but some may not; clicking enter as said above would enter the session directly; but clicking that username button makes necessary the password. Hopefully this application (Xfce4-session) will be in better shape in a future update.
How to enter/choose session after logout without password in (Linux Mint) Xfce?
1,364,557,534,000
If I lock the screen using gnome-screensaver (gnome-screensaver-command --lock) and enter the password, a big dot is shown instead of each character. Is it possible to change this behaviour such that no place-holders are shown if I type in my password (like normally in the shell)?
There's a way to change it but it doesn't completely answer your question. You can edit /usr/share/gnome-screensaver/lock-dialog-default.ui in your favorite text editor (be sure to make a backup first!). Scroll down and find <object class="GtkEntry" id="auth-prompt-entry"> <property name="can_focus">True</property> <property name="editable">True</property> <property name="visibility">False</property> <property name="max_length">0</property> <property name="text" translatable="yes"/> <property name="has_frame">True</property> <property name="activates_default">True</property> </object> "visibility" = False causes the password text effect. You can add a new property right below visibility to change the character (replacing the dot). <property name="invisible-char"> </property> I tried this on Debian 6 but it should work on any Gnome system. Unfortunately, it needs to show some kind of placeholder so it won't work like a terminal password prompt and show nothing. The closest I got was using a blank space. But you could experiment to see what does work.
gnome-screensaver-command --lock, hide password
1,446,056,069,000
There is an authentication failure when I'm trying to enter password for any of my accounts. I am logged in using ssh to my AWS EC2 instance. After a while I checked the privileges to files that store user information and found something strange. I don't think it's normal that: $ ls -l /etc/passwd /etc/shadow Results in this: -rw-r--r-- 1 root root 1402 Oct 7 10:58 /etc/passwd ---------- 1 root root 838 Oct 7 10:58 /etc/shadow This may be the cause of the problem, since no user can read/write the file. In my opinion the normal output for /etc/shadow should look something like this. -rw-r----- 1 root root 838 Oct 7 10:58 /etc/shadow Could this be the problem and how can I fix it? OS config: NAME="Amazon Linux AMI" VERSION="2015.09" ID="amzn" ID_LIKE="rhel fedora" VERSION_ID="2015.09" PRETTY_NAME="Amazon Linux AMI 2015.09" ANSI_COLOR="0;33" CPE_NAME="cpe:/o:amazon:linux:2015.09:ga" HOME_URL="http://aws.amazon.com/amazon-linux-ami/" Amazon Linux AMI release 2015.09
Amazon Linux, a RHEL clone, uses RPM to define the permissions on installed files. You can use the rpm -qf /etc/shadow command to determine the ownership. This shows that /etc/shadow is part of the setup package. You can then use the RPM database to query what the permissions should be for that file. There's a program called rpmls in the rpmdevtools package that does this, but you can do it with simple RPMs if you know the right syntax: $ rpm -q --qf='[%-11{filemodes:perms} %-8{fileusername} %-8{filegroupname} %{filenames}\n]' setup | grep /etc/shadow ---------- root root /etc/shadow This shows that it is expected that /etc/shadow are mode 0000. You shouldn't try to change it to something else. The PAM stack is perfectly capable of reading the shadow file. You must have some other problem.
Authentication failure on Amazon Linux
1,446,056,069,000
I can't use my former root password anymore. System: Debian Testing What did I do: log into root doing updates (with aptitude update && aptitude upgrade) aptitude install cryptsetup starting encryption by triple-checked cryptsetup -c aes-cbc-essiv:sha256 -y -s 256 luksFormat /dev/sdc7 Checked: date and time of /etc/passwd and /etc/shadow are like before no typing error (typed vissible) no one else logged in (last) not possible: /var/log/auth.log (needs su rights) Could the upgrade corrupt the password? (Help for resetting the password isn't needed, I think the old root shell "feature" still works.)
Success: Typing the password the next day, revealed, that my procedural (typing) memory access was working again and I used the Shift once more. So it was merely a typo. Good luck to all up-voters of the question :) (Procedural memory is different from the declarative or explicit or verbal memory. Expect bugs in both features, when having a hard time recalling a password :)
root password suddenly invalid [closed]
1,446,056,069,000
My OS is Ubuntu 14.04 64-bit, and kernel is 3.13.0-30-generic. I forget my user account password and now want to get into GUI desktop. I know from the Internet that we can reset password by single user mode. Usually this is done by editing grub2 items, like this "How do I boot into single-user mode from GRUB?", and this "Ubuntu 12.04 Grub to boot into single user mode " From the links, I can renew account password under shell, reboot, and login into desktop with the new password. But I don't want to renew the password, I simply want to login to the desktop. I have tried the command startx but it failed giving the following error: error in locking authority file .Xauthority I have searched the directory "root" and found no such file. How can I achieve my goal? Is it possible? EDIT: Single user mode runs at level 1 which is text mode. If I need X window, Linux must run at level 5. So I cannot get into GUI desktop at single user mode. But why I cannot use command startx at single user mode, remains to be solved. EDIT: I am at root text mode (at runlevel 1 of course) now through the reference link above. I can change any password now and reboot into GUI. But I would like to get into GUI by a "GEEK" way. That is bypassing the login screen of GUI and get there directly without password.
First of all the different runlevels are simply a question of what services are running. X (the GUI) does not start by default on runlevel 1 but that doesn't mean it can't. However, the Right Way® to start a graphical session from runlevel 1 is not to run startx but to start the login manager: sudo service lightdm start That should bring up your normal login screen and let you log in as usual. I'm not sure why you got that .Xauthority file. This is normally due to the file existing already but not owned by the user who is attempting to start X. You haven't clarified whether you're running startx as root or as your regular user but in either case, the fix is usually to remove .Xauthority. So, whichever user you are, just run rm ~/.Xauthority That should let you run startx but, again, you don't want to and will probably run into other problems down the line if you try it this way. Use lightdm instead.
Ubuntu 14.04 login into desktop by single user mode
1,446,056,069,000
If I use: john --incremental UNSHADOWEDFILE then I can see it uses only 1 CPU. How can I set john to use several CPU's for finding the weak passwords? (need to find weak ones faster because of an audit)
Basically you have to make sure that you use a recent John version that has OpenMP support enabled. If you compile it yourself you have to explicitly enable OpenMP support in the makefile (and verify that needed dependencies are available - e.g. a GCC >= 4.2). OpenMP support is not necessarily available for all hash methods, and the community edition (-jumbo) supports more than the official one. With the resulting binary you can verify if it has OpenMP via calling ldd on it - it should display some mp-related libraries. Also you can specify via the environment variable OMP_NUM_THREADS the number of cores a OpenMP program should use - if it is unset the default (on Linux) should be: all cores. See also the notes on OpenMP in John's Wiki.
How to run john parallel on several CPU's?
1,446,056,069,000
I found that, in /etc/inittab, this modification (-a username) for the user u disables the login/password check for all tty:s: 1:2345:respawn:/sbin/getty -a u 38400 tty1 2:23:respawn:/sbin/getty -a u 38400 tty2 3:23:respawn:/sbin/getty -a u 38400 tty3 4:23:respawn:/sbin/getty -a u 38400 tty4 5:23:respawn:/sbin/getty -a u 38400 tty5 6:23:respawn:/sbin/getty -a u 38400 tty6 That would be great for me, not having to type the password all the time! Question is, apart from the case when the computer gets stolen, the thief could use the system (which I would prefer, come to think of it), what security implications does this configuration have? Possibly relevant: The second column (runlevels).
I use autologin, not just disable the password ;-) If your disk is not encrypted, they could just boot from external media and steal your data. So autologin isn't a problem for thieves, but people near you (that can access your computer when you're not here). Just don't let people around you know that they could login as root without password... EDIT In this case, you run autologin at local tty, remote login normally use pts (pesudo tty), they don't interfere each other
Security drawbacks of disabling tty password check
1,446,056,069,000
The other day I burned a Chakra Linux iso on a dvd. When I booted into a live session I was able to access all my regular data. In dolphin when clicking on the icon belonging to my /home/user partition a pop-up asked me for my sudo password. The password I entered was not my regular sudo password, but the password that belongs to the live dvd. By default, this password is always root. Using the default password I was granted access to all partitions where I have stored my data, installed Linux Mint and installed Windows 7. I consider this to be a serious security breach. What is the point of having a password-protected account when all data can be accessed without the password by using a live dvd? Is this behaviour normal, or is something messed up on my system or is there something wrong with the Chakra distro?
If an attacker can boot a live CD in your environment, your environment is not secure. This is one of the reasons why physical security is so important. As a general rule, physical access to the machine is all that's ever needed to compromise it. Unix permissions are enforced by the kernel. If you run a live CD and are root, there's no real difference than being root on your own machine; there's nothing special about your environment. This is expected, and is normal. This is why data encryption is necessary if you want to hide your data from someone who can physically access your machine -- Unix permissions only protect you against an attacker attacking a running machine with a known permissions model, and known constraints (passwords, keys, etc) to stop an attacker from getting those permissions. If the attacker can manipulate the machine, boot into single user mode, boot a live environment, etc, then there's nothing you can do other than encrypt your data. Encryption is a good first step, but at every step (when you are entering your authentication to decrypt the volume, etc) you are trusting the computer not to lie to you. You cannot trust the computer if you do not at least have good physical security. Unix permissions require enforcement, and if your environment changes, that enforcement can become unexpectedly weaker.
Why can I access all my files without a password when booting with a Chakra Linux live CD?
1,446,056,069,000
I'm writing a script and need to check $user if his account has a password set, how can I do this? I know about this: passwd --status username Display account status information. The status information consists of 7 fields. The first field is the user's login name. The second field indicates if the user account has a locked password (L), has no password (NP), or has a usable password (P). The third field gives the date of the last password change. The next four fields are the minimum age, maximum age, warning period, and inactivity period for the password. These ages are expressed in days. but I need something that can fit in a if test Here is the code: userPass() { for i in "#@" do if [ "$i" = root ] then continue else echo "Changing password for $i:" echo $i:$i"YOURSTRONGPASSWORDHERE" | chpasswd if [ "$?" = 0 ] then echo "Password for user $i changed successfully" fi fi done } userPass $1 $2 $3
How about: if [ `passwd -S ${i} | cut -d" " -f2` == "P" ]; then do some stuff; fi
check whether the user has a password set for his account in a script
1,446,056,069,000
hscroot@hmcserver:~> grep root /etc/group root:x:0:hscroot,ccfw hscroot@hmcserver:~> hscroot@hmcserver:~> ls -la /etc/shadow -r-------- 1 root shadow 5252 2015-05-06 19:36 /etc/shadow hscroot@hmcserver:~> hscroot@hmcserver:~> cat /etc/shadow cat: /etc/shadow: Permission denied hscroot@hmcserver:~> hscroot@hmcserver:~> grep hscroot /etc/passwd hscroot:x:500:500:HMC Super User:/home/hscroot:/bin/hmcbash hscroot@hmcserver:~> hscroot@hmcserver:~> echo $DISPLAY localhost:10.0 hscroot@hmcserver:~> hscroot@hmcserver:~> su - bash: su: command not found hscroot@hmcserver:~> sudo su - bash: sudo: command not found hscroot@hmcserver:~> bash bash: bash: command not found hscroot@hmcserver:~> chs bash: chs: command not found hscroot@hmcserver:~> ksh bash: ksh: command not found hscroot@hmcserver:~> ls /bin/bash /bin/bash hscroot@hmcserver:~> /bin/bash bash: /bin/bash: restricted: cannot specify `/' in command names hscroot@hmcserver:~> exit exit Connection to 1.2.3.4 closed. [user@notebook ~]$ ssh [email protected] /bin/bash Password: /bin/bash: /bin/bash: restricted: cannot specify `/' in command names [user@notebook ~]$ Question: How can I cat the "/etc/shadow"? I only have "hscroot" user. I have X forward if I use "ssh -X".
You submit a support call to IBM who then give you the hscpe user password, which is good for one day. That user ID and password allows you to gain access to root (assuming you recorded the root password when you installed the HMC). Then you can cat /etc/shadow. You can't do it without root access (by design), and you can't simply switch to root either (also by design) on an HMC.
How to "cat /etc/shadow" on an HMC?
1,446,056,069,000
I've read answers to questions in this place and others that tell me that setting PasswordAuthentication and ChallengeResponseAuthentication to no will enable password-less logins but it's not working and yes I restarted the server. Here's my full sshd_config: # $OpenBSD: sshd_config,v 1.103 2018/04/09 20:41:22 tj Exp $ # This is the sshd server system-wide configuration file. See # sshd_config(5) for more information. # This sshd was compiled with PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin # The strategy used for options in the default sshd_config shipped with # OpenSSH is to specify options with their default value where # possible, but leave them commented. Uncommented options override the # default value. # If you want to change the port on a SELinux system, you have to tell # SELinux about this change. # semanage port -a -t ssh_port_t -p tcp #PORTNUMBER # #Port 22 #AddressFamily any #ListenAddress 0.0.0.0 #ListenAddress :: HostKey /etc/ssh/ssh_host_rsa_key HostKey /etc/ssh/ssh_host_ecdsa_key HostKey /etc/ssh/ssh_host_ed25519_key # Ciphers and keying #RekeyLimit default none # This system is following system-wide crypto policy. The changes to # crypto properties (Ciphers, MACs, ...) will not have any effect here. # They will be overridden by command-line options passed to the server # on command line. # Please, check manual pages for update-crypto-policies(8) and sshd_config(5). # Logging #SyslogFacility AUTH SyslogFacility AUTHPRIV #LogLevel INFO # Authentication: #LoginGraceTime 2m PermitRootLogin yes #StrictModes yes #MaxAuthTries 6 #MaxSessions 10 #PubkeyAuthentication yes # The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2 # but this is overridden so installations will only check .ssh/authorized_keys AuthorizedKeysFile .ssh/authorized_keys #AuthorizedPrincipalsFile none #AuthorizedKeysCommand none #AuthorizedKeysCommandUser nobody # For this to work you will also need host keys in /etc/ssh/ssh_known_hosts #HostbasedAuthentication no # Change to yes if you don't trust ~/.ssh/known_hosts for # HostbasedAuthentication #IgnoreUserKnownHosts no # Don't read the user's ~/.rhosts and ~/.shosts files #IgnoreRhosts yes # To disable tunneled clear text passwords, change to no here! #PasswordAuthentication yes #PermitEmptyPasswords no PasswordAuthentication no # Change to no to disable s/key passwords #ChallengeResponseAuthentication yes ChallengeResponseAuthentication no # Kerberos options #KerberosAuthentication no #KerberosOrLocalPasswd yes #KerberosTicketCleanup yes #KerberosGetAFSToken no #KerberosUseKuserok yes # GSSAPI options GSSAPIAuthentication yes GSSAPICleanupCredentials no #GSSAPIStrictAcceptorCheck yes #GSSAPIKeyExchange no #GSSAPIEnablek5users no # Set this to 'yes' to enable PAM authentication, account processing, # and session processing. If this is enabled, PAM authentication will # be allowed through the ChallengeResponseAuthentication and # PasswordAuthentication. Depending on your PAM configuration, # PAM authentication via ChallengeResponseAuthentication may bypass # the setting of "PermitRootLogin yes # If you just want the PAM account and session checks to run without # PAM authentication, then enable this but set PasswordAuthentication # and ChallengeResponseAuthentication to 'no'. # WARNING: 'UsePAM no' is not supported in Fedora and may cause several # problems. UsePAM yes #AllowAgentForwarding yes #AllowTcpForwarding yes #GatewayPorts no X11Forwarding yes #X11DisplayOffset 10 #X11UseLocalhost yes #PermitTTY yes # It is recommended to use pam_motd in /etc/pam.d/sshd instead of PrintMotd, # as it is more configurable and versatile than the built-in version. PrintMotd no #PrintLastLog yes #TCPKeepAlive yes #PermitUserEnvironment no #Compression delayed #ClientAliveInterval 0 #ClientAliveCountMax 3 #UseDNS no #PidFile /var/run/sshd.pid #MaxStartups 10:30:100 #PermitTunnel no #ChrootDirectory none #VersionAddendum none # no default banner path #Banner none # Accept locale-related environment variables AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE AcceptEnv XMODIFIERS # override default of no subsystems Subsystem sftp /usr/libexec/openssh/sftp-server # Example of overriding settings on a per-user basis #Match User anoncvs # X11Forwarding no # AllowTcpForwarding no # PermitTTY no # ForceCommand cvs server There's a question on here that seems very similar to mine but the user was using DSA whereas I am using RSA. Oh by the way I am using CentOS Linux release 8.3.2011. EDIT: here's the debugging output with -vv specified, and boy there's a lot of it: OpenSSH_8.2p1 Ubuntu-4ubuntu0.2, OpenSSL 1.1.1f 31 Mar 2020 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files debug1: /etc/ssh/ssh_config line 21: Applying options for * debug2: resolve_canonicalize: hostname 104.248.0.11 is address debug2: ssh_connect_direct debug1: Connecting to 104.248.0.11 [104.248.0.11] port 22. debug1: Connection established. debug1: identity file /home/readyready15728/.ssh/id_rsa type 0 debug1: identity file /home/readyready15728/.ssh/id_rsa-cert type -1 debug1: identity file /home/readyready15728/.ssh/id_dsa type -1 debug1: identity file /home/readyready15728/.ssh/id_dsa-cert type -1 debug1: identity file /home/readyready15728/.ssh/id_ecdsa type -1 debug1: identity file /home/readyready15728/.ssh/id_ecdsa-cert type -1 debug1: identity file /home/readyready15728/.ssh/id_ecdsa_sk type -1 debug1: identity file /home/readyready15728/.ssh/id_ecdsa_sk-cert type -1 debug1: identity file /home/readyready15728/.ssh/id_ed25519 type -1 debug1: identity file /home/readyready15728/.ssh/id_ed25519-cert type -1 debug1: identity file /home/readyready15728/.ssh/id_ed25519_sk type -1 debug1: identity file /home/readyready15728/.ssh/id_ed25519_sk-cert type -1 debug1: identity file /home/readyready15728/.ssh/id_xmss type -1 debug1: identity file /home/readyready15728/.ssh/id_xmss-cert type -1 debug1: Local version string SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.2 debug1: Remote protocol version 2.0, remote software version OpenSSH_8.0 debug1: match: OpenSSH_8.0 pat OpenSSH* compat 0x04000000 debug2: fd 3 setting O_NONBLOCK debug1: Authenticating to 104.248.0.11:22 as 'readyready15728' debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug2: local client KEXINIT proposal debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-c debug2: host key algorithms: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],ssh-ed25519,[email protected],rsa-sha2-512,rsa-sha2-256,ssh-rsa debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected] debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected] debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1 debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1 debug2: compression ctos: none,[email protected],zlib debug2: compression stoc: none,[email protected],zlib debug2: languages ctos: debug2: languages stoc: debug2: first_kex_follows 0 debug2: reserved 0 debug2: peer server KEXINIT proposal debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1 debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519 debug2: ciphers ctos: [email protected],[email protected],aes256-ctr,aes256-cbc,[email protected],aes128-ctr,aes128-cbc debug2: ciphers stoc: [email protected],[email protected],aes256-ctr,aes256-cbc,[email protected],aes128-ctr,aes128-cbc debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha1,[email protected],hmac-sha2-512 debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha1,[email protected],hmac-sha2-512 debug2: compression ctos: none,[email protected] debug2: compression stoc: none,[email protected] debug2: languages ctos: debug2: languages stoc: debug2: first_kex_follows 0 debug2: reserved 0 debug1: kex: algorithm: curve25519-sha256 debug1: kex: host key algorithm: ecdsa-sha2-nistp256 debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug1: Server host key: ecdsa-sha2-nistp256 SHA256:lpz47Ann4jSXUXiQNFwJGFf4bCWAgLiGiAsUUZPboSc debug1: Host '104.248.0.11' is known and matches the ECDSA host key. debug1: Found key in /home/readyready15728/.ssh/known_hosts:1 debug2: set_newkeys: mode 1 debug1: rekey out after 134217728 blocks debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug2: set_newkeys: mode 0 debug1: rekey in after 134217728 blocks debug1: Will attempt key: /home/readyready15728/.ssh/id_rsa RSA SHA256:A4h/c+bf2ziSWLIGBc76ZGYoLwPxxhHfZUerqfAYOs4 debug1: Will attempt key: /home/readyready15728/.ssh/id_dsa debug1: Will attempt key: /home/readyready15728/.ssh/id_ecdsa debug1: Will attempt key: /home/readyready15728/.ssh/id_ecdsa_sk debug1: Will attempt key: /home/readyready15728/.ssh/id_ed25519 debug1: Will attempt key: /home/readyready15728/.ssh/id_ed25519_sk debug1: Will attempt key: /home/readyready15728/.ssh/id_xmss debug2: pubkey_prepare: done debug1: SSH2_MSG_EXT_INFO received debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521> debug2: service_accept: ssh-userauth debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic debug1: Next authentication method: gssapi-with-mic debug1: Unspecified GSS failure. Minor code may provide more information No Kerberos credentials available (default cache: FILE:/tmp/krb5cc_1000) debug1: Unspecified GSS failure. Minor code may provide more information No Kerberos credentials available (default cache: FILE:/tmp/krb5cc_1000) debug2: we did not send a packet, disable method debug1: Next authentication method: publickey debug1: Offering public key: /home/readyready15728/.ssh/id_rsa RSA SHA256:A4h/c+bf2ziSWLIGBc76ZGYoLwPxxhHfZUerqfAYOs4 debug2: we sent a publickey packet, wait for reply debug1: Server accepts key: /home/readyready15728/.ssh/id_rsa RSA SHA256:A4h/c+bf2ziSWLIGBc76ZGYoLwPxxhHfZUerqfAYOs4 Enter passphrase for key '/home/readyready15728/.ssh/id_rsa': debug1: Authentication succeeded (publickey). Authenticated to 104.248.0.11 ([104.248.0.11]:22). debug1: channel 0: new [client-session] debug2: channel 0: send open debug1: Requesting [email protected] debug1: Entering interactive session. debug1: pledge: network debug1: client_input_global_request: rtype [email protected] want_reply 0 debug1: Remote: /home/readyready15728/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding debug1: Remote: /home/readyready15728/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding debug2: channel_input_open_confirmation: channel 0: callback start debug2: fd 3 setting TCP_NODELAY debug2: client_session2_setup: id 0 debug2: channel 0: request pty-req confirm 1 debug1: Sending environment. debug1: Sending env LANG = C.UTF-8 debug2: channel 0: request env confirm 0 debug1: Sending env LC_ALL = en_US.UTF-8 debug2: channel 0: request env confirm 0 debug2: channel 0: request shell confirm 1 debug2: channel_input_open_confirmation: channel 0: callback done debug2: channel 0: open confirm rwindow 0 rmax 32768 debug2: channel_input_status_confirm: type 99 id 0 debug2: PTY allocation request accepted on channel 0 debug2: channel 0: rcvd adjust 2097152 debug2: channel_input_status_confirm: type 99 id 0 debug2: shell request accepted on channel 0
Your SSH server is properly accepting passwordless logins; based on the output of ssh -vv that you posted it has accepted your key: debug1: Authentication succeeded (publickey). The reason why you are being prompted for a password still is because your private key is encrypted and has a password set, as per the request for which specific password to input: Enter passphrase for key '/home/readyready15728/.ssh/id_rsa': So I would recommend keeping your current settings they way they are, as this will protect your private key should your system ever become compromised. However, I would recommend not re-using passwords as it sounds like the password for your user account and the password for your private key may be the same.
SSH still asking for password after recommended changes
1,446,056,069,000
I recently changed my password on my VMware Photon OS host. Now I want to reset it to the old one again, but passwd does not let me do it and displays the following message: Password has been already used. Choose another. passwd: Have exhausted maximum number of retries for service passwd: password unchanged Can I override this behavior?
Be aware that reusing old passwords may impose security risks. The password history is stored at /etc/security/opasswd. You can either just remove the lines concerning specific users or delete the history for all users all at once: cat /dev/null > /etc/security/opasswd
How can I reuse an old password?
1,446,056,069,000
I am trying to read a password from stdin into a variable in a Bash script. This variable should then be expanded into an ssh-command and transmitted to the server. There, the password should arrive in correctly escaped manner, so it can be used as input for another command. (In this case to change the login-password of my pihole). Currently I have something like: read -rs -p "Password: `echo $'\n> '`" newpass ssh root@gate "pihole -a -p \"${newpass}\"" But also tried: ssh root@gate "pihole -a -p ""'""${newpass}""'" ssh root@gate 'pihole -a -p '"${newpass}" ssh root@gate 'pihole -a -p '"${newpass}"'' ssh root@gate "pihole -a -p \'${newpass}\'" ssh root@gate 'pihole -a -p ''\''"${newpass}"'\'' Even with printf: IFS= read -rs -p "Password: `echo $'\n> '`" newpass command=$(printf 'pihole -a -p %s\n' "$newpass") or IFS= read -rs -p "Password: `echo $'\n> '`" newpass command=$(printf 'pihole -a -p '\''%s'\''\n' "$newpass") and many more. But with this password: a$#5!6k?h'v;z' they all fail. And there isn't even a back-tick in it, yet... My question to all you Bash Gurus out there is: What is the correct way to parse a password into a variable, where the user may enter literally any character? This includes: $ ! ` (backtick) ' (single quote) " ; # @ \ / ~ \n and so on... I have read all the related questions here and in other forums, but couldn't find a solution for this use case. I know, that there will be people who suggest to use Python or C or something else, but still I'm interested in Bash's capabilities. However, if it definitely isn't possible to accomplish with Bash, then I'm also interested in ideas on how you would do this (cleanly and securely) with other tools. Thanks in advance
$ echo "$pw" $!@`', $ echo "${pw@Q}" '$!@`'\'',' That should do it. I do not know, though, in which version of bash this was introduced. This works, too, and may have been available earlier: $ printf %q "$pw" \$\!@\`\'\, # or, avoiding the command substitution $ printf -v pw_ql1 %q "$pw" $ echo "$pw_ql1"
Best practice to read password, containing special characters like $!@`', into Bash script
1,446,056,069,000
These are standard sshpass commands to read password from file or as argument. user@linux:~$ sshpass -f pwd.txt ssh admin@server admin@server:~$ user@linux:~$ sshpass -p P@55 ssh admin@server admin@server:~$ Is it possible to write the same program/script in shell if expect not available? Public/private key is not the option in this case. If there's available code to provide the same functionality as sshpass out there, please let me know. The simplest the code, the better.
You can script(1) as a mini-expect, provided that you can cope with adjusting arbitrary timeouts, which is of course quite kludgy: { sleep 1; echo PASSWD; } | script -q /dev/null -c 'ssh user@host CMD' or with the syntax of BSD's script(1): { sleep 1; echo PASSWD; } | script -q /dev/null ssh user@host CMD The sleep is necessary because ssh will drain the tty's input buffer (and discard whatever was already written to it) before reading the password. If the remote server is sometimes slow to respond, using a "large-enough" timeout may be unpractical. sshpass, expect etc handle that by waiting to ssh to write the ... password: prompt before they write the password to the master end of the pty. Doing that from a standard shell is neither simple nor very robust. Here is a kludge using a named pipe: passwdcmd(){ t=$(mktemp -u); mkfifo "$t" || return script /dev/null -qc "$2" <>"$t" | { dd count=1 2>/dev/null; echo "$1" >"$t"; rm "$t"; cat; } } passwdcmd PASSWD 'ssh user@host CMD' Of course, this is not very secure, especially since echo may not be a/the shell built-in. For any non-interactive use of ssh, use public key authentication.
sshpass alternative in linux shell/bash code
1,446,056,069,000
I'm running Bananian linux on my Banana Pro recently I changed some config settings but quit it with ctrl + c without finishing editing all the config settings. After restart I am unable to login with default login - "root", I get the error incorrect login every time I try. I tried checking my username in /etc/passwd and /etc/shadow /etc/passwd file root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin bin:x:2:2:bin:/bin:/usr/sbin/nologin sys:x:3:3:sys:/dev:/usr/sbin/nologin sync:x:4:65534:sync:/bin:/bin/sync games:x:5:60:games:/usr/games:/usr/sbin/nologin man:x:6:12:man:/var/cache/man:/usr/sbin/nologin lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin mail:x:8:8:mail:/var/mail:/usr/sbin/nologin news:x:9:9:news:/var/spool/news:/usr/sbin/nologin uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin proxy:x:13:13:proxy:/bin:/usr/sbin/nologin www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin backup:x:34:34:backup:/var/backups:/usr/sbin/nologin list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin systemd-timesync:x:100:103:systemd Time Synchronization,,,:/run/systemd:/bin/false systemd-network:x:101:104:systemd Network Management,,,:/run/systemd/netif:/bin/false systemd-resolve:x:102:105:systemd Resolver,,,:/run/systemd/resolve:/bin/false systemd-bus-proxy:x:103:106:systemd Bus Proxy,,,:/run/systemd:/bin/false ntp:x:104:109::/home/ntp:/bin/false sshd:x:105:65534::/var/run/sshd:/usr/sbin/nologin . /etc/shadow file root:$6$9KzHxAiY$L8WtC4E1KoZYbzaxMCK4AhpVGfS3oKLNdn1YjIbunGcQDJLm8GwjRy1fXU7vhHh7DrR8hNChqPnaoL76efh/f/:14610:0:99999:7::: daemon:*:16628:0:99999:7::: bin:*:16628:0:99999:7::: sys:*:16628:0:99999:7::: sync:*:16628:0:99999:7::: games:*:16628:0:99999:7::: man:*:16628:0:99999:7::: lp:*:16628:0:99999:7::: mail:*:16628:0:99999:7::: news:*:16628:0:99999:7::: uucp:*:16628:0:99999:7::: proxy:*:16628:0:99999:7::: www-data:*:16628:0:99999:7::: backup:*:16628:0:99999:7::: list:*:16628:0:99999:7::: irc:*:16628:0:99999:7::: gnats:*:16628:0:99999:7::: nobody:*:16628:0:99999:7::: systemd-timesync:*:16628:0:99999:7::: systemd-network:*:16628:0:99999:7::: systemd-resolve:*:16628:0:99999:7::: systemd-bus-proxy:*:16628:0:99999:7::: ntp:*:16628:0:99999:7::: sshd:*:16628:0:99999:7:::
Since you seem to have access to /etc/shadow as a privileged user (sudo?), do sudo passwd root If on the other hand, you are editing the filesystem in the MicroSD card in another machine, just edit out the root password in /etc/shadow. Delete the encrypted password field as in: root::14610:0:99999:7::: Then you will be able to enter as root in the console, press ENTER when asked for the password, and change it once you login with passwd.
Unable to recover lost login
1,446,056,069,000
I was currently learning to create plymouth themes/scripts from this link while following the guide i came across the Plymouth.SetDisplayPasswordFunction area, and after quite an amount of searching on the internet i got lots of information on creating password dialogs in plymouth themes. I don't understand what is a password dialog doing at such an early phase of booting.I assume that it should show when the GDM has started and plymouth has exited. I am totally confused, please someone explain me what is it in details and what does it do..
Certain cases of disk encryption require you to enter a passphrase during boot to unlock the root partition, else the system can't continue booting, because it can't get its data from disk. Only the boot partition won't be encrypted (or is unlocked by GRUB), so the kernel and the initramfs can still be loaded. But that alone makes a very poor experience, with only BusyBox as a shell and no files to work with. Without a Plymouth splash, the password prompt will simply be written on the TTY, e.g. something like this: With Plymouth, you can have a password prompt drawn over the boot splash. Here are some examples: (All images taken from Google Image Search)
What is a password dialog in plymouth?
1,446,056,069,000
I have the following settings in file /etc/pam.d/common-password. password requisite pam_cracklib.so retry=3 lcredit=-1 ucredit=-1 dcredit=-1 password [success=1 default=ignore] pam_unix.so obscure use_authtok try_first_pass sha512 password requisite pam_deny.so password required pam_permit.so password optional pam_ecryptfs.so Why can root set a weak password for another user? root@kali:~# LANG=C passwd kali New password: BAD PASSWORD: it is WAY too short BAD PASSWORD: is a palindrome Retype new password: passwd: password updated successfully I don't see any pam rule that is allowing it. Am I missing something?
In newer (and backported into RHEL 6) versions of PAM, there is an option to pam_cracklib you want to add — enforce_for_root. This is off by default. Just add it to that line, and there you go. Of course, without a lot of other constraints (SELinux, say), root can always go around PAM and set the password another way (like, writing directly to the appropriate file), so consider this more of a way of keeping yourself honest rather than solid restriction. Why does it work this way rather than expecting the stack to take care of that kind of thing? I think it's just a matter of flexibility, especially back when the PAM control values were just the simple required/requisite/sufficient/optional — you'd have to put pam_rootok with a control value of sufficient above all of the checks that root would ignore, but only those. Since the option to succeed as root is built into pam_cracklib itself, that's not necessary (assuming that allowing root to skip the check is desired, which it apparently is, even if not in your case).
Why root is not constrained by pam
1,446,056,069,000
How can I disable root password caching? I looked at This Question, but I didn't really understand how to do it, is not the same as my question but it is indirectly related. I tried adding this to /etc/sudoers: timestamp_timeout=0 But it gave me: >>> /etc/sudoers: syntax error near line 46 <<< So I just pressed x. 46 is the line where I added it, so there isn't a problem with anything else.
Try: Defaults timestamp_timeout=0 An example from man 5 sudoers, where a value is appended to an option: Defaults env_keep += "DISPLAY HOME"
Disable root password caching
1,446,056,069,000
I have a CentOS 7 image on my local machine that I want to allow login as root. This is going to be a system dedicated for testing. I initially tried using rescue mode and added kernel param "systemd.unit=emergency.target" but it says root login is locked. So I start /bin/bash instead. I see root in /etc/shadow is locked using "!!". So I run passwd root and assign it a password. However, I am still unable to login as root. It keeps telling me password incorrect (I'm sure password is correct). Is there somewhere else I overlooked? I am logging in via console, not using SSH.
Most likely you modified the filesystem in an emergency shell or from a rescue disk. Your SELinux labels are probably wrong for /etc/shadow. Easiest fix is to touch /.autorelabel and reboot normally. It will relabel the filesystem and reboot.
CentOS 7 - how to login as root
1,446,056,069,000
I can't log in to KDE, as other users to the GUI on my Debian systems only the user created at install. I can log on in the command line: su - user into the users login but only in the shell. I have created a login shell usermod -s /bin/bash user and deleted users and created new ones useradd -m user I've tried to change the password: sudo passwd user cat /etc/passwd # gives Óuser:x:1001:1001::/home/Óuser:/bin/bash os-release: PRETTY_NAME="Debian GNU/Linux 9 (stretch)" NAME="Debian GNU/Linux" VERSION_ID="9" VERSION="9 (stretch)" ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/" When I try to login I get login failed like when you have a wrong password but I'm sure I have the right passwords.
Usernames on Debian systems must start with an ASCII letter or underscore, and then only contain letters, digits, dashes or underscores. The username may end with an optional $. The maximum length is 32 characters. Instead of Óli, I would suggest oli and then to set the user's "real name" to Óli. See also: What is the regex to validate Linux users?
Can't log in to other users on a debian system
1,446,056,069,000
I have an ubuntu linux image, which I use for my single board computer. When I write it the media (it's an sdcard), then boot and log in, it asks me to change the password. Since I can mount and modify the sdcard content with another computer before actually performing the boot, I'd like to disable the password expiry. I know that on a running system I can use chage, but in this case, the target system is on the card. Is it possible to do it?
From man chage: -R, --root CHROOT_DIR Apply changes in the CHROOT_DIR directory and use the configuration files from the CHROOT_DIR directory. So just chroot to the mount point of your sdcard. Editing shadow to delete the expiry times bypasses the normal mechanisms. It could in principle fail if shadow is backed by a database, your login reads credential from NIS, and other similar situations, but you probably don't have any of these oddball situations on a sdcard. So editing shadow should work too.
How to disable password expiry without chage?
1,446,056,069,000
I have a .txt file and I have a bash script where txt file will be zipped and moved to other sftp server. I am using zip -P pass foo.zip foo.txt Here in the script the password is visible but I should not save the hard coded password over there . Can any one help me out?
From the zip man page, -P password --password password Use password to encrypt zipfile entries (if any). THIS IS INSECURE! Many multi-user operating systems provide ways for any user to see the current command line of any other user; even on stand-alone systems there is always the threat of over-the-shoulder peeking. Storing the plaintext password as part of a command line in an automated script is even worse. Whenever possible, use the non-echoing, interactive prompt to enter passwords. (And where security is truly important, use strong encryption such as Pretty Good Privacy instead of the relatively weak standard encryption provided by zipfile utilities.) As it is mentioned in the man page, THIS IS HIGHLY INSECURE! So, you can try the below, From the zip man page again, --encrypt Encrypt the contents of the zip archive using a password which is entered on the terminal in response to a prompt (this will not be echoed; if standard error is not a tty, zip will exit with an error). The password prompt is repeated to save the user from typing errors. The command goes something like, zip --encrypt foo.zip foo.txt which asks for password on terminal, Enter password: Verify password: updating: foo.txt (stored 0%) WARNING: The encryption used by zip is not really a strong one. It can be cracked easily!
zip file issue using password
1,446,056,069,000
man 3 crypt clearly states that it uses DES. I thought DES was deprecated, but I see no notice that crypt would be deprecated. Why does it not use AES instead, and is crypt(3) deprecated? Is it simply a case of "DES is secure enough for the purpose of this library", and that programs should use other libraries for encryption of important stuff?
crypt is easily breakable (it was in fact written by Robert Morris, a famous contributor to the early Unix, as a workbench for codebreaking activities) and should not be used for anything important. From the crypt manpage: The DES algorithm itself has a few quirks which make the use of the crypt() interface a very poor choice for anything other than password authentication. If you are planning on using the crypt() interface for a cryptography project, don't do it: get a good book on encryption and one of the widely available DES libraries. For any real-world use, there are cryptographically stronger alternatives available, such as mcrypt and ccrypt (which uses AES).
Why does crypt(3) use DES? [closed]
1,446,056,069,000
I’ve successfully installed Debian 12 and upon reboot, I’m attempting to login to the desktop environment for the first time. After I type in the password on the login screen, the following screen flashes briefly and I’m taken back to the login screen. If I change username to root and try to login with my root password on the login screen, the screen will shake, telling me I don't have the right password. (I made sure the password is correct) I am, however, able to press ctrl+alt+f3 to get the CLI and I am able to login using both my user account name/pw and root. Anyone know why I can't login to the desktop environment? What's causing this and how I can fix it? I have KDE Plasma installed and here are my specs: MB: B550I AORUS PRO AX Resolution: 2560×1440, 2560×1440 CPU: AMD Ryzen 5 5600X (12) @ 3.700GH GPU: NVIDIA GeForce RTX 3080 Memory: 32044MiB
So on the login screen, there are two desktop sessions: Plasma (Wayland) and Plasma (X11). When I switched to Plasma (X11), I was able to login. Not sure why there are two sessions, that will be another question.
Cannot login to newly installed Debian 12, stuck on the login screen
1,654,423,942,000
As said in this question in comments, empty password and no password are different things. So what's the difference between empty password and no password in Linux Debian?
One still has a password hash, but the other does not. Password hashing functions can accept an empty string. So if the front end interface allows the user to submit an empty string as a password, then the password will validate. If this is the case, there is an actual password hash stored on the back end that will only validate if the password hashing function receives an empty string. Any other input will result in authentication failure. If there is no password at all, there is no password hash, and the field where that hash is normally located is completely empty. No matter what attempted password is supplied, authentication will never succeed.
What's the difference between empty password and no password?
1,654,423,942,000
I am using pwck for the first time with Lynis 3.0.7 on Ubuntu 20.04 server and I have some strange output. I hope someone might help me interpret what I am seeing. I am working on freshly installed, clean systems, that I "trust" (for now) to be clean. I don't understand the "invalid password file entry" response and how to correct it. Obviously, I am checking the passwd and shadow files. Why is it showing legitimate entries as invalid?
The invalid entries aren’t legitimate: they have two login shells. For example, sync:*:4:65534:sync:/bin:/bin/sync:/usr/sbin/nologin should only have sync:*:4:65534:sync:/bin:/bin/sync All your invalid entries have an extra :/usr/bin/nologin appended. In most cases, if you were to follow the advice in the guide you’re reading, you’d actually replace the last entry: clamav:x:109:109::/var/lib/clamav:/usr/sbin/nologin However, for entries already using /bin/false, this makes no practical difference in terms of security; see What's the difference between /sbin/nologin and /bin/false for details. Your analysis of /etc/shadow fails because pwck expects the first file given to it to be a passwd file, not a shadow file. To analyse a shadow file, you need to provide the corresponding passwd file simultaneously: pwck -r /etc/passwd /etc/shadow (This replaces both your commands to analyse /etc/passwd and /etc/shadow in one go.)
Interpretting PWCK Output
1,654,423,942,000
I am trying to read a password from user, i used -s silent flag but read -s is not working from the script but it works if i do it manually from terminal. error details project.sh: 3: read: Illegal option -s you entered code maddy@ElementalX:~/Desktop$ cat project.sh #!/usr/bin/sh read -s -p "Enter Password: " pswd echo "you entered $pswd" maddy@ElementalX:~/Desktop$
The -s option to the built-in utility read is not a standard option, and is unlikely to be implemented in sh. Likewise, the -p option for giving a custom prompt is unlikely to be implemented by a generic sh. Run your script with bash instead, whose read does support -s for reading from the terminal without echoing the typed-in characters (and also -p). The easiest way to do this is to change the #!-line to point to the bash executable on your system. In a non-bash shell, you may get a similar effect with printf 'Enter password: ' >&2 stty -echo read password stty echo
read -s gives error via script
1,654,423,942,000
Is there any standard way to setup user password hints in Linux machine? To later check it out from the console (terminal) login?
You could probably write a PAM module to do just that. Of course, anything that could show a per-user message would work, but both pam_issue or pam_motd only seem to know about global messages. Though with SSH, you can set a per-user Banner, but I don't think you can make the configuration any cleaner than repeating the same two lines for every user: Match User someuser Banner /etc/banners/someuser Match User otheruser Banner /etc/banners/otheruser The banner is if course shown before the first login attempt. As for if you should use password hints, I do suspect the answer is "no", since it's too easy to make the whole password guessable if the hint is going to be of any use. ("Security questions" like "your first pet's name" are even worse.) But go ask the nice folks over at security.SE about that, starting with e.g. An analysis of storing hints for passwords?
Can I set password hint on linux