

#PWGEN COMMAND LINE LINUX INSTALL#
Next, create a random password with pwgen command:īy default, pwgen utility is not installed so you can install it with the help of apt-get or yum command, enter: Make sure /root/tmp.pass file contains non-root usernames only. First, you need to find out all non-root accounts using the awk command:Īwk -F: '' /etc/passwd > /root/tmp.pass This command is intended to be used in a large system environment where many accounts are created at a single time or in an emergency situation. Remember by default the supplied password must be in clear-text format. Each line has the following format: user_name:password
#PWGEN COMMAND LINE LINUX UPDATE#
The chpasswd command reads a list of user name and password pairs from file and uses this information to update a group of existing users. Support at XXX-XXXX-ZZZZ or Tip: Update all users password in a batch modeĬreate a random password for each non-root user using chpasswd utility. If you have any questions please contact tech Other users will be shown the contents of this file and their logins will denied or refused.ġ) Login as root user (terminal login only)Ģ) Create a file called /etc/nologin enter: You need to create a file called /etc/nologin. Since rest of account do not have any password, it is necessary to prevent non-root users from logging into the system. # reboot Step # 4 Block all non-root loginīlock all non-root (normal) users until you fix all password related problems. In our situation, admin was the only account allowed to use su and sudo command: On most production servers direct root login is disabled. If you have an admin account, then setup password for that account too. You need to type the same password twice. Next, use the passwd command to set a new root user account password, enter: It creates /etc/shadow from /etc/passwd and an optionally existing shadow. Step #3: Rebuild /etc/shadow file from /etc/passwd Note: Do not forget to (re)mount your rest of all your partitions in read/write (rw) mode such as /usr, /var, /home, /tmp etc. To mount partitions in read write mode, enter: Step #2: Make sure you can access the system partitionīy default / file system will be mounted in a read-only mode and many disk partitions have not been mounted yet, you must do the following to have a reasonably functioning system. This allowed us to gain root privileges and a root shell. This causes the system to boot the kernel and run /bin/bash instead of its standard init. Press enter key to exit edit mode.Īt the GRUB screen, type b to boot into a single user mode. Go to the end of the line and type init=/bin/bash as a separate one word (press the spacebar and then type init=/bin/bash). Select the line that starts with kernel and type e to edit the line. Select Recovery mode version of the kernel that you wish to boot and type e for edit. However, ftp was working fine because proftpd was build using MySQL database. As a result, all account login (sftp/ssh) got disabled. It all started when one of our client accidentally deleted a file called /etc/shadow from co-located Debian Linux server.
