0

I am on rocky linux 9.2, I want root home directory to be simply ‘/‘ not root or anything else so I changed the sshd configuration file to this

Match User root
    ChrootDirectory none
    AuthorizedKeysFile .ssh/authorized_keys
    AllowTcpForwarding yes
    PermitTunnel yes
    ForceCommand none

but now i cant connnect to ssh at all. It depends on the application but it just says failed to initialize. I also tried the following combinations

Match User root
    ChrootDirectory /
    AuthorizedKeysFile .ssh/authorized_keys
    AllowTcpForwarding yes
    PermitTunnel yes
    ForceCommand none

Match User root
    ChrootDirectory /

Match User root
    ChrootDirectory /var
6
  • Wouldn’t “/“ be the root directory of the disk? I am confused. Provide the verbose logs of the client and server while the client is connecting
    – Ramhound
    Commented Jul 9 at 3:08
  • Yes, the root directory, the one that contains var, etc and so on. I want that to be the starting directory
    – Cain Nuke
    Commented Jul 9 at 3:09
  • so sparing you the expected advice that I don;t think this is a good idea at all. consider that root transcends SSH login, so you you'd best be looking for means to globally change roots home directory, rather than mucking around in your ssh config. I wanna say its in passwd, but check for your distribution. Commented Jul 9 at 3:51
  • @CainNuke - You want to give users access to that directory? So why did say otherwise in your question, “not root or anything else”, suggests you don’t
    – Ramhound
    Commented Jul 9 at 3:54
  • I only want root to access. As of now root is jailed in the directory called root. I cant do nothing from there when I access sftp.
    – Cain Nuke
    Commented Jul 9 at 6:08

0

You must log in to answer this question.

Browse other questions tagged .