Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 11-23-2013, 05:46 PM   #1
LQ Newbie
Registered: Nov 2013
Posts: 2

Rep: Reputation: 0
Need to run SSH as root


I am new to Linux. Today I installed openssh-server and client in order to connect to my linux server in the cloud.

Most settings are configured at this point. I touched a file at ~/.ssh/config to setup my favorite ssh clients, so it's possible to connect my Linux server with the command ssh *servername*.

The questing at this point is the fact that I only can use this command as root. If I run the command 'ssh servername' without root permissions I get the following error: "ssh: Could not resolve hostname ********: No such file or directory".

If I run the command "sudo ssh servername" the SSH client makes a succesfull connection with the SSH server.

How can I change this? For security reasons I like the fact that I've to need root permission. But what makes this possible?

Thanks in advance.
Old 11-23-2013, 06:16 PM   #2
Senior Member
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,284

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
That's a bit odd. It sounds like your ssh client is having trouble resolving host names when run as a non-root user. What kind of machine (OS and version) are you using as a client? It sounds like some variant of *nix. Can you resolve names otherwise as a non-root user? E.g., can you open a web browser and browse to say, on the client?

One other thought, is servername the actual fully qualified domain name of your server? Did you perhaps define an alias in root's ~/.ssh/config on your client and then try to use that alias from your normal user account? If so, you'll need to add the alias to the normal user account's ~/.ssh/config to use it.
Old 11-23-2013, 10:17 PM   #3
Senior Member
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,630

Rep: Reputation: 495Reputation: 495Reputation: 495Reputation: 495Reputation: 495
a few things.

1. verify that the ssh_config is in both the root and user ~/.ssh/ directory

2. verify that the domain is matched to the IP address in /etc/hosts
Old 11-24-2013, 04:20 AM   #4
Senior Member
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,706

Rep: Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270
You might also check the permissions on /etc/hosts - it must be readable by all users.
Old 11-25-2013, 02:29 AM   #5
LQ Newbie
Registered: Nov 2013
Posts: 2

Original Poster
Rep: Reputation: 0
I am using Linux Mint. From the web browser I could resolve hostnames and browse the web. However I have the directory .ssh not in my home folder. I copied this directory. But still the same error message. Finally I decided to remove Openssh-Server and Client and install it again. At this point everything goes well. Configured Openssh-server and ~/.ssh/config in my home folder. Now I can start a ssh session without root permissions. Still I don't know what causes this problem.

Thanks for your time and input.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
root terminal has different bash config when I ssh in vs su from another ssh account stardotstar Linux - General 4 07-01-2010 06:24 PM
How to ssh as root to a workstation and then run commands as another user. martinhb Linux - Security 5 06-10-2009 10:04 PM
run a specific script with root privilege as any user(possibly with ssh) z940303 Programming 5 09-05-2007 08:20 PM
Is a script, run at boot time from init.d, run with root authority? tmbrwolf53 Linux - Server 2 03-31-2007 08:15 PM
I have to ssh -l root to run root processes!? paul.nel Red Hat 3 11-15-2004 11:55 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:39 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration