Page 1 of 1

sshd config file

Posted: Fri Mar 21, 2014 12:21 am
by garycooke
can anyone tell me what line 1 of the sshd config file should say please, i tried to make a change (below)

sudo nano /etc/ssh/sshd_config (and then a number)

when i boot the pi now i get the line below towards the end of booting up

Starting open BSD secure shell server:sshd/etc/ssh/sshd_congfig:line1:bad configuration:Xxx/etc/ssh/sshd_config:terminating, 1 bad configuration
failed!

Re: sshd config file

Posted: Fri Mar 21, 2014 12:44 am
by klricks
The 1st non # line in my file is:
Port 22

For the best help, it would probably be best if you copy and paste the contents of your sshd file here using

Code: Select all

 tags and tell what you are trying to accomplish.

Re: sshd config file

Posted: Fri Mar 21, 2014 7:12 am
by garycooke
I had read a post someone had put and copied that line, now i get falied when i boot the pi, so i just want to put it back as it was or take the line out if anyone knows how to remove it.
I was putting a port number in so the pi could talk to the router with that port number, i have since found out my router won't let me open ports unless i get a business account with BT so the whole thing was a waist of time anyway.

Re: sshd config file

Posted: Fri Mar 21, 2014 7:30 am
by garycooke
Now i am thinking about it, i wonder if i should get rid of the number at the end of that line, if someone can tell me how to do that please, i think that i should of typed what i did without the number then gone into that file and changed the number (ie port 22 to the port number i was using)
If i am right which i very much doubt all i need is someone to tell me how to delete that whole line i put in

Sorry again for time waisting

Re: sshd config file

Posted: Fri Mar 21, 2014 1:16 pm
by klricks
I am not sure what your problem is? What number at the end of what line?
Just edit the file like you did before and put it back to the way it was before, then save and exit.

Re: sshd config file

Posted: Fri Mar 21, 2014 2:16 pm
by sdjf
If you want to remove a line you added to a file, if you don't know how to delete it, then you just put a pound sign (#) at the start of the line, which turns it into a comment.

This is lesson that before you edit any system files, it is wise to make a backup of them so if something gets broken, you still can use the old file.

cp -p oldfilename oldfilename.bak

If you want to remove something at the end of a line, how to do that depends on what text editor you are using. In some, all you have to do is go into the file and backspace over the words or characters you want to remove, and save the file. In vi, you position the cursor on the line, and to delete the line, type :d if you are not in visual mode.

Re: sshd config file

Posted: Fri Mar 21, 2014 3:18 pm
by garycooke
i just typed the line that started with sudo nano and like an idiot put a port number at the end of it instead of in the file, now i am getting a failed message, i know it's to do with what i have done.
i was in home/pi and am unsure where this file was saved, once i can find where the line is i will delete it

Re: sshd config file

Posted: Fri Mar 21, 2014 6:44 pm
by sdjf
try running the following to check the most recently changed files:

ls -alt /home/pi/*