M
M
Meloman4eg2014-04-04 12:40:05
SSH
Meloman4eg, 2014-04-04 12:40:05

How to access files on server via 2 ssh?

Good afternoon!
Suppose there is an internal company network (intranet).
You can connect there via ssh, through a public server commonserver.company.ru
Inside it there are many sites with addresses site1.company , site2.company , and so on.
I want to connect to the site site1.company from home , and also edit files in my editor that are on this site.
To access this internal site, I enter the command in the terminal (the port can be any)
ssh -D 3355 [email protected]общийсервер.компания.ru
and then in Firefox I put "Manual proxy settings", where in the SOCKS line I have 127.0.0.1 3355
After that, I can open sites through firefox site1 .companies ,site2.company , and so on.
But I also want to access the files on the site1.company server so that I can edit them in my editor.
I can access files, for example, after this sequence:

ssh [email protected]общийсервер.компания.ru
ssh [email protected]сайт1.компани

Then I can edit files in the terminal. But from Nautilus, I can’t connect to the site1.company server, I can’t, only to the generalserver.company.ru server .
How do I connect to the server via 2 ssh?
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
f2nd, 2014-04-05
@f2nd

Do you happen to have a vpn there? Because so far the only option that comes to mind is with an SSH tunnel through which the second SSH is used to connect sshfs. This is fraught on channels with jitter and / or packet loss, because TCP inside TCP and congression control in such a situation will work at both levels, which can lead to all sorts of unpleasant effects such as a long session hang.
SSH option:

ssh -L 2222:сайт1.компани:22 [email protected]общийсервер.компания.ru
sshfs -p 2222 localhost:/путь_к_каталогу_на_сайт1.компани/ /локальный_каталог

Instead of port 2222, you can specify any other free port above 1024.
You can read more about all sorts of tricks with SSH in the amarao post:
habrahabr.ru/post/122445

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question