LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Need to run SSH as root (https://www.linuxquestions.org/questions/linux-newbie-8/need-to-run-ssh-as-root-4175485672/)

jvreeswijk 11-23-2013 05:46 PM

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

btmiller 11-23-2013 06:16 PM

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.

lleb 11-23-2013 10:17 PM

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

jpollard 11-24-2013 04:20 AM

You might also check the permissions on /etc/hosts - it must be readable by all users.

jvreeswijk 11-25-2013 02:29 AM

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.


All times are GMT -5. The time now is 06:12 PM.