0

Hello I realy dont have a lot of knowledge about servers/ftp etc so i'm sorry if i don't sound undertandable juste tell me how to tell you more acurate info.. I have followed a tutorial to make my ftp use sftp here is the link : https://memo-linux.com/mettre-en-place-un-serveur-sftp-sous-debian-8/ the link is not in english but this is what i did :

apt install openssh-server

then i opened /etc/ssh/sshd_config

nano /etc/ssh/sshd_config

and i changed Port 22 to Port 666 also i added this at the end of the file :

Subsystem sftp internal-sftp
         Match group sftp
         ChrootDirectory /home/%u
         X11Forwarding no
         AllowTcpForwarding no

then i have written all these commands in the terminal :

addgroup sftp
mkdir -p /home/fred
useradd -s /bin/false -d /home/fred -g sftp fred
passwd fred
chown root:root /home/fred/
chmod -R 770 /home/fred/
usermod -d / fred

then the tutorial asked to activate the sftp this way :

systemctl restart ssh

But I got this error :

Job for ssh.service failed. See 'systemctl status ssh.service' and 'journalctl -xn' for details.

Then i got logged out so I tried to reconnect with theses ways but no one worked :

sftp fred@IPofServer

got : ssh: connect to host IPofServer port 22: Connection refused

sftp fred@IPofServer:666

got : ssh: connect to host IPofServer port 22: Connection refused

ssh fred@IPofServer

got : ssh: connect to host IPofServer port 22: Connection refused

ssh root@IPofServer

got : ssh: connect to host IPofServer port 22: Connection refused

ssh root@IPofServer -p 666

ssh: connect to host IPofServer port 666: Resource temporarily unavailable

sftp -oPort=666 root@IPofServer

ssh: connect to host IPofServer port 666: Resource temporarily unavailable

Now I have changed the file using Webmin (I dont know why he can connect to the server but he did..) i changed back 666 to 22 and removed the piece of code from the end of the file

but still :

ssh root@IPofServer

ssh: connect to host IPofServer port 22: Connection refused

If you need more info please tell me

  • Your ssh server is not running, that's why you cannot connect. You made some mistake in sshd_config file. Your error message says to check the output of 'systemctl status ssh.service' and 'journalctl -xn' commands. What do they show? – raj Sep 11 at 12:23
  • but i can't run any command now because I can't connect.. how am i supposed to check the output ? – AACT2 Sep 11 at 12:34
  • Do you have any other way to access the machine? Can you physically access it and login? – raj Sep 11 at 12:36
  • No.. only webmin allows me to see and edit files but the terminal doent allow me for exemple : [root@save ~]# ls Error opening terminal: unknown. – AACT2 Sep 11 at 12:37
  • I see now that you have reverted your config file back to previous state. So you only need a way to start your ssh server again. Can you do it using webmin? – raj Sep 11 at 12:38
0

Using Webmin I just restarted the SSH server manualy this way : Webmin -> Servers -> SSH Server -> Start button

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.