How to edit file via ssh

Tim on your unofficial InterWorx pages, I find that one should be able to use “vi filename” to edit a text file.

When I use that this way:

vi /etc/ssh/sshd_config

It then open up a seemingly blank text editor, and being used to Windows I was expecting to see the contents of the currently file so I could easily edit needed lines.

What other text ediors do we have?

nano /etc/ssh/sshd_config


Did you edit the file as root? /etc/ssh/sshd_config can only be edited by a privileged user, so if you’re not root, the file will show up empty (probably with a “permission denied” error somewhere).

Well, yes and no, I am still trying to disallow direct root login this following the directions precisely.

I logged in a new user I added, then I did “su -” to root

Seems like I am having a few field days!

Before I called BellSouth, where they had me reset my ADSL modem and unplug and replug cables and both modem and network router, I tried using “vi” to edit the above mentioned file. As I could not see anything to edit, and soon used “:qa!” to exit.

Now I get an error message when trying to login via SSH:

The host ‘’ is unreachable.
The host may be down, or there may a problem with the network connection.
Sometimes such problems can also be caused by a misconfigured firewall"

Maybe it’s time for that carrer change!

Oh yeah my attempts using “vi” messed up the sshd_config file!

Had to contact Sagonet twice in one day to tell them I am stupid - damn.

command not found!

Damn don’t this piece of crap Linux have a decent text editor which shows the text file on lines so you can edit them?

Geez I freaking hate Linux!

yum install nano

ty very much :slight_smile:

[root@server1 /]# yum install nano
Gathering header information file(s) from server(s)
Server: Red Hat Linux 9 - Base
Server: Red Hat Linux 9 - Fedora Legacy - Updates
Server: InterWorx-CP - Generic
Server: InterWorx-CP - Red Linux 9
Server: Red Hat Linux 9 - Updates
Finding updated packages
Downloading needed headers
Cannot find a package matching nano
No actions to take

I am gonna go out and get drunk now!

I am now a happy, after a Vodka and Juice, I stubornly searched for a nano download. Quickly had to figure out how to download and install it.

Well anyways I was able to edit the file with nano, disallow direct root logins, and restart ssh :slight_smile:

Yes - I can now login using another login and “su -” to root - yupiiiii

The morale behind the story? Alcohol is good for you, or me at least!

Haha, you just needed to be in the right frame of mind. Good to hear you got your problem solved. :slight_smile: