LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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, 05: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, 06:16 PM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
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, 10:17 PM   #3
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
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
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
You might also check the permissions on /etc/hosts - it must be readable by all users.
 
Old 11-25-2013, 02: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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:51 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
Open Source Consulting | Domain Registration