Restart the Server…this need to be done from within your hypervisor......
When the Photon OS splash screen appears as it restarts, type the letter ‘
e'
to go to the GNU GRUB edit menu quickly. Because Photon OS reboots so quickly, you won’t have much time to type e
.Second, in the GNU GRUB edit menu, go to the end of the line that starts with
linux
, add a space, and then add the following code exactly as it appears below:rw init=/bin/bash
WARNING : On version 3.6 or above you need this on the line that says Linux:
/boot/$photon_linux root=$rootpartition rw init=/bin/bash
Note : in some cases when you add the mentioned text and proceed with boot, boot will stuck and will not continue …in this cases be sure to have same text exactly as it look in the screenshot below
4. After you add this code, the GNU GRUB edit menu should look exactly like this:
Now type F10
or Ctrl -x
5. At the command prompt, type passwd
and then type (and re-enter) a new root password that conforms to the password complexity rules of Photon OS. Remember the password.
Next, type the following command:
umount /
Finally, type the following command. You must include the -f
option to force a reboot; otherwise, the kernel enters a state of panic.
reboot -f
This sequence of commands should look like this:
After the Photon OS machine reboots, log in with the new root password.
To reset the count, before you unmount the filesystem, run the following…
/sbin/pam_tally2 --reset --user root
Final optional bit is enabled SSH....
To permit root login over SSH, open /etc/ssh/sshd_config
with the vim text editor and set PermitRootLogin
to yes
.
Vim is the default text editor available in both the full and minimal versions of Photon OS. The full version also contains Nano. After you modify the SSH daemon's configuration file, you must restart the sshd daemon for the changes to take effect. Example:
vim /etc/ssh/sshd_config
# override default of no subsystems
Subsystem sftp /usr/libexec/sftp-server
# Example of overriding settings on a per-user basis
#Match User anoncvs
# X11Forwarding no
# AllowTcpForwarding no
# PermitTTY no
# ForceCommand cvs server
PermitRootLogin yes
UsePAM yes
Save your changes in vim and then restart the sshd daemon:
systemctl restart sshd