LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


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

Rep: Reputation: 0
Need to run SSH as root


Hi,

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.
jvreeswijk
 
Old 11-23-2013, 07:16 PM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,275

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
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, www.google.com 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, 11:17 PM   #3
lleb
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, 05:20 AM   #4
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,602

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
You might also check the permissions on /etc/hosts - it must be readable by all users.
 
Old 11-25-2013, 03:29 AM   #5
jvreeswijk
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.
 
  


Reply


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 07:24 PM
How to ssh as root to a workstation and then run commands as another user. martinhb Linux - Security 5 06-10-2009 11:04 PM
run a specific script with root privilege as any user(possibly with ssh) z940303 Programming 5 09-05-2007 09:20 PM
Is a script, run at boot time from init.d, run with root authority? tmbrwolf53 Linux - Server 2 03-31-2007 09:15 PM
I have to ssh -l root to run root processes!? paul.nel Red Hat 3 11-15-2004 12:55 PM


All times are GMT -5. The time now is 04:08 AM.

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