# ssh login and password in one line



## atomlov (Jun 24, 2005)

I'm very new to Terminal scripting. I'm actually just attempting to make an Automator Workflow that will upload some photos for a Flash based gallery.

The problem is I need to be able to change the chmod of the folder I upload. Is there a why to put the password in the connection script "ssh -1 username@site.com"?

Also, how do you write an AppleScript that will execute a shell script in an already open window, rather than attempting to open a new one?

I'd really appreciate any help! Thanks, Adam


----------



## laanak (Jul 2, 2005)

atomlov said:
			
		

> The problem is I need to be able to change the chmod of the folder I upload. Is there a why to put the password in the connection script "ssh -1 username@site.com"?



for the chmod part of ur question...go the folder that u wanna change using ur terminal, then type "chmod 755 _"name of the folder u wanna change"_" no...there is no way to put ur password into the shell script bcuz....its a security feature of unix based OSs' terminals to be ultra_secure i.e. it wont let u put ur password in a shell script as it sees it as a hazard...


----------



## spb (Jul 3, 2005)

You can ssh into sites without a password if you create an ssh key pair.  

There are tons of sites about how to do this, here is one (http://www.centos.org/docs/2/rhl-cg-en-7.2/openssh-clients.html)

sb


----------



## btoneill (Jul 3, 2005)

You could also have your login script change your umode. Setting your umode sets the default file privleges on files you create. Also see what spb said about setting up ssh key pairs (if it's supported on the remote system). You can also look at using the 'expect' language which is designed for automating tasks done via command line.

Brian


----------



## lurk (Jul 5, 2005)

One more data point.  If you create a public-private key pair with a password you can use ssh-agent or one of its front ends to do a single sign on.  You enter your password there and it will then handle the authentication.  This is particularly nice if you need to ssh too a box that you then need to ssh from, the authentication is passed up the chain and you need never enter the password.


----------

