0

I have this Ubuntu 20.04 VPS which was working fine an hour back, but now I am unable to login to my sudo user. The root login is also disabled.

When it was working, I deployed a static website and wanted to install certbot ssl from sudo user, but it was getting denied that I don't have permission. After searching online I found something to change permission which is sudo chmod 755. Then it worked and my website was running, but then I got logged out and can't log back in. The password is correct and I tried this:

ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no -p 4256 user@<ip>

Then it says: Permission Denied.

What is going on here? How can I fix it? I don't want to reinstall the whole server. I have everything in there. My hosting's support refused to help me as I got a self-managed one without cPanel.

Here's a Pastebin for all the output I'm getting after running ssh -v user@13.210.34.26 -p 4256

OpenSSH_8.5p1, OpenSSL 1.1.1k  25 Mar 2021
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to 13.210.34.26 [13.210.34.26] port 4256.
debug1: Connection established.
debug1: identity file /c/Users/Admin/.ssh/id_rsa type -1
debug1: identity file /c/Users/Admin/.ssh/id_rsa-cert type -1
debug1: identity file /c/Users/Admin/.ssh/id_dsa type -1
debug1: identity file /c/Users/Admin/.ssh/id_dsa-cert type -1
debug1: identity file /c/Users/Admin/.ssh/id_ecdsa type -1
debug1: identity file /c/Users/Admin/.ssh/id_ecdsa-cert type -1
debug1: identity file /c/Users/Admin/.ssh/id_ecdsa_sk type -1
debug1: identity file /c/Users/Admin/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /c/Users/Admin/.ssh/id_ed35314 type 3
debug1: identity file /c/Users/Admin/.ssh/id_ed35314-cert type -1
debug1: identity file /c/Users/Admin/.ssh/id_ed35314_sk type -1
debug1: identity file /c/Users/Admin/.ssh/id_ed35314_sk-cert type -1
debug1: identity file /c/Users/Admin/.ssh/id_xmss type -1
debug1: identity file /c/Users/Admin/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.5
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.2p1 Ubuntu-4ubuntu0.3
debug1: compat_banner: match: OpenSSH_8.2p1 Ubuntu-4ubuntu0.3 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 13.210.34.26:4256 as 'user'
debug1: load_hostkeys: fopen /c/Users/Admin/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curved35314-sha256
debug1: kex: host key algorithm: ssh-ed35314
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-ed35314 SHA256:aZS4ZFL/olGXqpcNScSQVXFY0UlmJ4sKCSugT/1nRvC0pGOLJLXOCrA
debug1: load_hostkeys: fopen /c/Users/Admin/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: checking without port identifier
debug1: load_hostkeys: fopen /c/Users/Admin/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: Host '13.210.34.26' is known and matches the ED35314 host key.
debug1: Found key in /c/Users/Admin/.ssh/known_hosts:3
debug1: found matching key w/out port
debug1: check_host_key: hostkey not known or explicitly trusted: disabling UpdateHostkeys
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /c/Users/Admin/.ssh/id_rsa
debug1: Will attempt key: /c/Users/Admin/.ssh/id_dsa
debug1: Will attempt key: /c/Users/Admin/.ssh/id_ecdsa
debug1: Will attempt key: /c/Users/Admin/.ssh/id_ecdsa_sk
debug1: Will attempt key: /c/Users/Admin/.ssh/id_ed35314 ED35314 SHA256:Ay9qo3SK2DdG9PQDKY+O3y+c54HrrjHdkCsGoM4Fyck
debug1: Will attempt key: /c/Users/Admin/.ssh/id_ed35314_sk
debug1: Will attempt key: /c/Users/Admin/.ssh/id_xmss
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ED35314,sk-ssh-ed35314@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Trying private key: /c/Users/Admin/.ssh/id_rsa
debug1: Trying private key: /c/Users/Admin/.ssh/id_dsa
debug1: Trying private key: /c/Users/Admin/.ssh/id_ecdsa
debug1: Trying private key: /c/Users/Admin/.ssh/id_ecdsa_sk
debug1: Offering public key: /c/Users/Admin/.ssh/id_ed35314 ED35314 SHA256:Ay9qo3SK2DdG9PQDKY+O3y+c54HrrjHdkCsGoM4Fyck
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Trying private key: /c/Users/Admin/.ssh/id_ed35314_sk
debug1: Trying private key: /c/Users/Admin/.ssh/id_xmss
debug1: Next authentication method: keyboard-interactive
karel
  • 122,695
  • 134
  • 305
  • 337
s.khan
  • 111
  • 3
    I changed permission of one of the directories Which one and what changes? – ChanganAuto Nov 25 '21 at 12:39
  • @ChanganAuto I deployed a static website and wanted to install certbot ssl from sudo user. But it was getting denied that I don't have permission. So after searching online I did some sudo chmod 755 thing```. But before this I had to use some other because none was working. – s.khan Nov 25 '21 at 12:41
  • 1
    @s.khan please [edit] your question with all the relevant information about what you did – steeldriver Nov 25 '21 at 12:42
  • @steeldriver done. Can you guys please tell me how to fix this? I have so many apps and so many data in there. – s.khan Nov 25 '21 at 12:44
  • You've not given specific details about what you did; nor any OS & release details. If you did what you said you did, I'd expect an error like chmod: missing operand after ‘755’ (ie. it's an incomplete command for most OSes on-topic here; the message may of course vary for your unstated release) – guiverc Nov 25 '21 at 13:01
  • @guiverc Brother, I don't remember. I just copy-pasted commands. But it was something like sudo chmod/chown 755 and another (I guess) with root:root included. I used those so that I can install certbot for my static website in /var/www directory. And my Ubuntu version is 20.04 – s.khan Nov 25 '21 at 13:05
  • Guys, I have a vps dashboard given by the hosting. It has: Reboot, Shutdown, Boot, Reinstall, VNC, Log, Power Off, Reconfigure Networking and Rescue. Anything I can do from this list, except reinstalling? – s.khan Nov 25 '21 at 13:15
  • Here's a pastebin for ssh verbose https://pastebin.com/jb1YLqqS – s.khan Nov 25 '21 at 13:54
  • We don't know what you did; eg. the chmod command you gave would have resulted in an error as I've already said; however if you did give path/files; the effect could impact programs due to permissions change. eg. if you did it to /etc/sudoers (440 is normal) it wouldn't have impacted any active sudo users but would have stopped any future sudo attempts. Your command history should show what you did; but my example needs 440 (not 755) to work as expected. /etc/passwd should be 644 etc.. We don't know what you changed as that is what needs to be fixed. – guiverc Nov 25 '21 at 21:14

1 Answers1

1

unfortunately you will have to uninstall and reinstall the entire application from scratch, so I don't know why, but I uninstalled and installed it and now it's okay

svend06
  • 11
  • I now have access to rescue mode. But I don't know what to do here. Still trying to recover from this mess – s.khan Nov 25 '21 at 16:05