LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Questions about SSH (https://www.linuxquestions.org/questions/linux-newbie-8/questions-about-ssh-4175573213/)

RobInRockCity 02-27-2016 12:05 PM

Quote:

Originally Posted by suicidaleggroll (Post 5507187)
That said, I don't understand the question. What can't you see in the terminal? There's no directory structure or file where? Best guess at interpreting your question is that you're confused about the difference between relative and absolute paths:
http://www.linuxnix.com/abslute-path...-in-linuxunix/

cliffordw and you recommended this command to get the fingerprint from my server...
Code:

ssh-keygen -lf /etc/ssh/ssh_host_rsa_key.pub

If I ssh into my server I end up here...
Code:

vps-user@mydomain.com [~] #
If I type ls at that prompt I see lots of directories including etc/

If I then type...
Code:

cd etc/

ls

then I see this...
Code:

./  ../  cacheid  mydomain.com/
There is no path: /etc/ssh/ssh_host_rsa_key.pub


And even if I look in the directory: mydomain.com/ I don't see anything in it.


So I concur - and thank you guys - for the command to get the fingerprint for my server, but am curious why that command works when I don't see that directory structure or file in my VPS account.

See?

pan64 02-27-2016 12:10 PM

not etc but /etc (probably)

suicidaleggroll 02-27-2016 12:29 PM

I repeat:
Best guess at interpreting your question is that you're confused about the difference between relative and absolute paths:
http://www.linuxnix.com/abslute-path...-in-linuxunix/

"etc" is a relative path that depends on your current location. "/etc" is an absolute path that does not depend on your current location. Unless you are currently sitting in "/", they are not the same directory. Please read the link.

RobInRockCity 02-27-2016 01:58 PM

Quote:

Originally Posted by suicidaleggroll (Post 5507206)
I repeat:
Best guess at interpreting your question is that you're confused about the difference between relative and absolute paths:
http://www.linuxnix.com/abslute-path...-in-linuxunix/

I read that. Would be nice if you'd read what I said and help me figure out where I am stuck.

Quote:

Originally Posted by suicidaleggroll (Post 5507206)
"etc" is a relative path that depends on your current location. "/etc" is an absolute path that does not depend on your current location. Unless you are currently sitting in "/", they are not the same directory. Please read the link.

Why do you seemingly read and response to every other thing I say? Come on, man.

I said above...
Quote:

There is no path: /etc/ssh/ssh_host_rsa_key.pub
Looks like an absolute path to me...

Would be nice if people answer my questions instead of talking around them...

suicidaleggroll 02-27-2016 02:41 PM

If the command ran without error, like you said it did, then the file does exist.

Run the following to see it:
Code:

ls -l /etc/ssh/ssh_host_rsa_key.pub
If you can't find it while navigating the directory structure, the only explanation is you don't understand relative vs absolute paths. Your example above shows you going to the "etc" subdirectory of your user's home directory, something like /home/vps-user/etc/, which is of course not the same place as /etc. You can always use the command "pwd" to see where you currently are.

RobInRockCity 02-27-2016 04:27 PM

Quote:

Originally Posted by suicidaleggroll (Post 5507241)
If the command ran without error, like you said it did, then the file does exist.

Run the following to see it:
Code:

ls -l /etc/ssh/ssh_host_rsa_key.pub
If you can't find it while navigating the directory structure, the only explanation is you don't understand relative vs absolute paths. Your example above shows you going to the "etc" subdirectory of your user's home directory, something like /home/vps-user/etc/, which is of course not the same place as /etc. You can always use the command "pwd" to see where you currently are.

I don't have access to /home/ because I am not root... :rolleyes:

suicidaleggroll 02-27-2016 05:06 PM

Quote:

Originally Posted by RobInRockCity (Post 5507272)
I don't have access to /home/ because I am not root... :rolleyes:

What? Did you run something and get an error, or are you just making assumptions again about what you can/cannot do without actually trying anything? Everyone can access /home, that's where everyone's home directory is (except root, which is at /root).

1) Log into the system
2) Run "pwd"

RobInRockCity 02-27-2016 06:44 PM

Quote:

Originally Posted by suicidaleggroll (Post 5507282)
What? Did you run something and get an error, or are you just making assumptions again about what you can/cannot do without actually trying anything? Everyone can access /home, that's where everyone's home directory is (except root, which is at /root).

1) Log into the system
2) Run "pwd"

When I ssh into the server I see this...
Code:

vps-user@mydomain.com [~]#
Then if I do this...
Code:

cd ../
I get this...
Code:

vps-user@mydomain.com [/home]#
Then if I do this...
Code:

vps-user@mydomain.com [/home]# ls
I get this...
Code:

/bin/ls: cannot open directory .: Permission denied

Which means that I am unable to navigate here to see that this exists...
Code:

ls -l /etc/ssh/ssh_host_rsa_key.pub

Yes I can run this, and yes it gives me the fingerprint, but that isn't what I asked...

I asked why I can execute something I can't navigate to.

suicidaleggroll 02-27-2016 09:33 PM

You don't have read permission for /home, but you still have execute permission which allows you to traverse the directory structure. The permissions on /home say nothing about the permissions on /etc or /etc/ssh anyway. You can't do an ls in /home, but you can still cd up to /, perhaps ls there, cd to /etc, ls there, etc.

RobInRockCity 02-28-2016 09:05 AM

Quote:

Originally Posted by suicidaleggroll (Post 5507356)
You don't have read permission for /home, but you still have execute permission which allows you to traverse the directory structure. The permissions on /home say nothing about the permissions on /etc or /etc/ssh anyway. You can't do an ls in /home, but you can still cd up to /, perhaps ls there, cd to /etc, ls there, etc.

Hah! That worked - I was able to "hack" my way into the /etc directory. :)


All times are GMT -5. The time now is 11:10 PM.