I have connected one of my production server folders with my "ssh account" server via sshfs
.
I often need to find out pwd
(or realpath
) of the file on the original (production) server, but the pwd returns the path to file on the connected ("ssh account") server.
Is there a way to get original path?
Thanks
Edit: more about this: I am using this to link my ssh server to multiple different SFTP servers/shared hosting.
so, if i do this (on some of the servers): sshfs user@domain:/ mount_point
, then I am connected to my FTP account, which acts as root for my user, but is more along something like /var/www/clients/c/a/account/pub/
and that's the path I need –
sshfs user@domain:/ mount_point # mount SFTP acc.
cd mount_point
XXXX file.ext # get back: /var/www/clients/…/pub/file.ext
pwd file.ext # returns /ssh-server/path/mount_point/file.ext
Hope it makes sense now.
Thanks
/ssh-account/path/to/file
… the wrong onesshd
on the server is run in a chroot such that its/
is not the actual/
on the server and you want that actual/
, there is no way to get the actual/
on the server via ssh. You could, however, still define an alias as suggested in my answer and simply replace the/var/www/mywebsite
accordingly (for example, use/var/www/clients/c/a/account/pub
or so). In order not to define multiple aliases, you could parse the output ofmount
, decide where this actually points to using the username given tosshfs
and then build the output accordingly.pwd --see-through-every-mount-and-symlink
:Dpwd --blatantly-defy-chroot --ignore-filesystem-restrictions --find-absolutely-the-absolute --accept-no-substitutes --never-surrender
?