FreeBSD ssh forgot password



1. Two methods for cracking passwords for freeBSD

These two methods have been verified by me.

The first one :
1. Boot into the boot menu

2. Select each item (press 4) to enter single-user mode (4.boot frebsd in single user mode)

after entering, you will see: Enter full pathname or shell or RETURN for /bin/sh:

At this time, go back directly, and a "#" sign will appear. At this time, you cannot directly crack the password, which means that you cannot use the passwd command now, because the single The file system in user mode is not mounted, so mount the file system first.

3. After entering, enter a list of commands

root@#mount -a

root@#passwd (change password command)

"changing local password for root
Newpasswod:
Retry New Password :
"#"

reboot

or passwd root

"changing local password for root
Newpasswod:
Retry New Password:
"#" will appear after

changing #init 6 (restart)
The above method is suitable for SSH remote and local

second 1.
Boot into the boot menu

2. Select each item (press 4) to enter single-user mode (4 .boot frebsd in single user mode).

After entering, you will see: Enter full pathname or shell or RETURN for /bin/sh:

At this time, go back directly, and "# ”, the password cannot be directly cracked at this time, which means that the passwd command cannot be used now, because the file system in single-user mode is not mounted, so mount the file system first,

mount -a

cd /etc
vi master.passwd
to find root :*:%^$#@#%$%^^$%&&&**^%%%$##:0:0:0:charies: /root:/sbin/sh 
delete those special characters and keep the colon.
Save and exit Regenerate /etc/master.passwd
with the command pwd_mkdb -p /etc/master.passwd.

Re-run and restart After

normal startup, you can log in directly by entering root in login without entering a password.


The second method is suitable for local, if it is suitable for SSH remote, you have to change a file.

vi /etc/ssh/sshd_config

Find the following two items in the file:

#PermitRootLogin no Change to PermitRootLogin yes
#PermitEmptyLogin no Change to PermitEmptyLogin yes

So that you can log in remotely with an empty password~, hehe~

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326940774&siteId=291194637