Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I was editing PuTTY's config file /etc/ssh/sshd_config. I didn't know how to save the file (:w and :q) so I quit PuTTY. It crashed the file so I reopened and saved it.

But now PuTTY tells me:

Access denied.

I rebooted the server in safe mode (or something like that - netboot system I think). How can I reset the configuration of /etc/ssh/sshd_config?

share|improve this question
1  
need for information from you. WHAT file were you editting? you weren't editting putty's configuration, since it is a windows program, and :w and :q are commands for vim an editor in linux. so what file were you changing? /etc/ssh/sshd_config ? –  cpbills May 19 '10 at 16:54
    
i was editing : /etc/ssh/sshd_config –  Tristan May 19 '10 at 17:01
    
What where the changes you made? –  Zypher May 19 '10 at 17:05
    
no idea. i was adding : Port 1337 # Changer le port par défaut Protocol 2 AllowUsers dew I UPDATED THE POST, please read :p –  Tristan May 19 '10 at 17:08
add comment

1 Answer

up vote 4 down vote accepted

since you acknowledged you were modifying /etc/ssh/sshd_config over ssh, and you screwed up the file, and for some reason sshd restarted, you're SOL, since i presume you /only/ have remote access.

if you have plesk or cpanel or some other web interface that allows you to download/upload system files, edit system files, or even reset to default the system files, that would be your next place to look.

you could upload a new copy of /etc/ssh/sshd_config, though i don't know how to guide you through a control panel interface, and then restart sshd on the server, or if you can edit the files or restore to default to fix your errors.

beyond that, you will have to contact their support and ask that they reset the file /etc/ssh/sshd_config and restart the ssh server for you.

to fix your problems, you will want to modify the file and undo the changes you did, and find any syntax errors. you can find syntax errors by running /usr/bin/ssh -t which will check for correctness.

in another response, it sounds like you changed the default port, have you tried connecting to your host, specifying /that/ port in putty?

share|improve this answer
    
i only, now have access to a netboot system with utilities like testdis, parted, mdam, makedev,grub, lsof......... (and a lot more). I don't have CPanel or Plesk, but i can reset my server. Is this that important so i can reset the server ? –  Tristan May 19 '10 at 17:12
    
if /you/ have no way to access your server, and fix the files, then you will have to contact customer support for your host. –  cpbills May 19 '10 at 17:14
    
crap, didn't know it was so messed up to screw one line of a cfg file. Hopefully, i didn't put my website on it. Thanks –  Tristan May 19 '10 at 17:16
    
having customer support fix the issue is a better solution to wiping the system and starting fresh, especially if you have put any amount of work into setting up the server. it would be a simple fix for them to just reset your sshd_config –  cpbills May 19 '10 at 17:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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