how can I run remotley my test script without password?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
how can I run remotley my test script without password?
Hi all,
how can I run remotely my test script without password?
lets say user named "user" at host2 that has script located on /tmp/test.sh
I like to run that script on host1 using this:
ssh user@host2 'bash /tmp/test.sh'
the script actually runs but it ask me a password to login on host2. Is there a shortcut way so I would only just run the script next time without putting the password to host2?
thanks, seems like all of you has same idea to to solve my problem. I'll try it
different scenario this time
script from host2 is owned by user2 and located on /opt/user2/bin/test.sh
but 1st for me to able to run the script from host2 I need to be logged as "user" then sudo su to "user2"
running this command in host2 as user= sudo su - user2
question is I want to run the script from host1 using "user"
I tried this = ssh user@host2 'sudo su - user2 -c /opt/user2/bin/test.sh'
it asked the password for user2 but it gives me this error = sudo: sorry, you must have a tty to run sudo
Last edited by apss_evaluator; 06-27-2014 at 03:35 AM.
I tried it, but looks like it still did not execute the script the way I expected
#ssh user@host2 '/opt/user2/bin/test.sh'
ls: cannot open directory /opt/user2/packages: Permission denied
/opt/user2/bin/test.sh: line 133: kill: (23125) - Operation not permitted
/opt/user2/bin/test.sh: line 136: kill: (23125) - Operation not permitted
ls: cannot access /opt/user2/pkg/jboss-/server/default/deploy: No such file or directory
Last edited by apss_evaluator; 06-27-2014 at 03:36 AM.
Apart from 0) not using 'ls' in scripts if you are going to parse the output, 1) testing before you do something and 2) using a completely different "user" account ("user != "user2") to execute your script "ssh user@host2" I think you should cut this short by posting the actual full contents of "/opt/user2/bin/test.sh", what it should achieve, determine the owner of the process with PID 23125 and check why (sub)directory ownership doesn't match the (presumed) "user2" account.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.