1
How can I make ssh admin@nas command
work if command
is in /opt/bin
?
On my QNAP NAS File /root/.ssh/rc:
echo "old path is $PATH"
export PATH=/opt/bin:/opt/sbin:$PATH
echo "new path is $PATH"
on my machine:
~$ ssh admin@nas 'echo $PATH'
returns
old path is /usr/bin:/bin:/usr/sbin:/sbin
new path is /opt/bin:/opt/sbin:/usr/bin:/bin:/usr/sbin:/sbin
/usr/bin:/bin:/usr/sbin:/sbin
so the path variable is not preserved. How can I achieve that?
Edit:
As I mentioned in my comment below the command I'm trying to use is git or, more specific git-upload-pack
and git-receive-pack
and probably some others. I want to use them in different locations and occasions and don't want to bother setting up a git config on every machine I use it on or teach my IDE how to communicate with my NAS but rather have my NAS conforming standards. So i figured that all I need is to set the right $PATH
Edit II:
what i did try so far was also inserting the export PATH=...
as well as adding another echo
(to verify they're run) to ~/.bash_profile
, to /etc/profile
and to ~/.bashrc
. Apparently none of them are even executed when I run a non-interactive command like above. If I do ssh admin@nas
all of them are executed, but that doesn't help
stick it in ~/.bash_profile – shorif2000 – 2013-04-19T14:35:35.880
i tried that along with adding another echo (to verify they're run) to
~/.bash_profile
, to/etc/profile
and to~/.bashrc
. Apparently none of them are even executed when I run a non-interactive command like above. If I dossh admin@nas
all of them are executed, but that doesn't help – user2298896 – 2013-04-19T14:43:18.357How about
~/.bashrc
? – Scott – 2013-04-19T20:11:04.580As described in my previous comment, I tried that – user2298896 – 2013-04-20T12:33:59.067
log into root using
su -
– shorif2000 – 2013-04-22T09:37:43.837I ended up creating Symlinks to the commands in question in
/bin
. That works for me. – user2298896 – 2013-04-23T16:57:35.280