Can't access to SSH using PuTTY

probably, yes.

Removing one triggered removal of the other. So, both are removed, but still the same line exists.

**# cat /etc/shadow**
root:$1$.twrdEuT$bpjcS88KCZk5e/fFXmnme0:17871:0:99999:7:::
daemon:*:0:0:99999:7:::
ftp:*:0:0:99999:7:::
network:*:0:0:99999:7:::
nobody:*:0:0:99999:7:::
dnsmasq:x:0:0:99999:7:::
sshd:x:0:0:99999:7:::

I don't know what this means. If the command worked, it would have removed the sshd entry, unless you're saying that it was automatically repopulated.

In my earlier suggestion, we were:

  1. making a copy of the shadow file from /etc/ to the root 'home' directory ~/
    2a) using sed to remove the last line
    2b) putting the results of the sed command into /etc/shadow (effectively overwriting the original file).

if that didn't work, it is possible that there was actually a new line at the end of the file, in which case you could pipe another sed in there

sed '$ d' ~/shadow | sed '$ d' > /etc/shadow

I meant removal of openssh components...
Sorry for the confusion.

ok... now try removing the last line (sshd) of the shadow file. And test logging in via ssh.

First command result:

# cp /etc/shadow "~/shadow"
cp: can't create '~/shadow': No such file or directory

Command failed (Code: 256)

do not use quotes...
cp /etc/shadow ~/shadow

Ok, but the lines are the same in the commands window

# sed "$ d" "~/shadow" ">" /etc/shadow
root:$1$.twrdEuT$bpjcS88KCZk5e/fFXmnme0:17871:0:99999:7:::
daemon::0:0:99999:7:::
ftp:
:0:0:99999:7:::
network::0:0:99999:7:::
nobody:
:0:0:99999:7:::
dnsmasq:x:0:0:99999:7:::
sed: ~/shadow: No such file or directory
sed: >: No such file or directory

Command failed (Code: 256)

is that the output of the /etc/shadow file?

it looks like you're putting in extra quotes..

No.

# cp /etc/shadow "~/shadow"
cp: can't create '~/shadow': No such file or directory

Command failed (Code: 256)

# sed "$ d" "~/shadow" ">" /etc/shadow
root:$1$.twrdEuT$bpjcS88KCZk5e/fFXmnme0:17871:0:99999:7:::
daemon::0:0:99999:7:::
ftp:
:0:0:99999:7:::
network::0:0:99999:7:::
nobody:
:0:0:99999:7:::
dnsmasq:x:0:0:99999:7:::
sed: ~/shadow: No such file or directory
sed: >: No such file or directory

Command failed (Code: 256)

DO NOT USE QUOTES!

Seriously, you're messing it up.

Post the output of this:
cat ~/shadow

The Forum is putting quotes here...
44%20AM

ok... sorry.

what is the current result of this:

cat /etc/shadow

Here are the results of all commands:
46%20AM!
46%20AM%20001 !
47%20AM !

Don't you think a factory reset wouldn't be the easier course of action at this point?

Custom DNS servers, making dnsmasq hand out external DNS servers as part of the DHCP lease or setting up dDNS are relatively trivial, compared to this kind of debugging.

1 Like

Ok, I would like to troubleshoot the current error for not going over the same steps again.
I would put your conclusion on my mind. Thanks.

+1 to @slh's suggestion.

FWIW, the screen grab clearly shows that the quotes are showing up in the commands you are issuing -- I don't know if this is an artifact of the luci-app-commands environment or if you incorrectly entered it (look at your first screenshot, right before "command failed")

You are right, but there are no quotes as you can see on my previous post.

whatever the case, you need to make sure there are no double quotes. you want single quotes (') around the sed argument, and that is all. Exactly as I had written earlier (I think in comment 31)