[Techtalk] Shell script not working for a remote ssh login - manually entering commands work fine

Lucky Lady needlesschatter at yahoo.com
Wed Mar 12 16:06:51 EST 2003


Thanks Hugo - it works.

DaLy
--- Hugo Chasqueira <hchasqueira at netcabo.pt> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Lucky Lady escreveu:
> 
> > I just set up a remote ssh logon without using a
> > password. All works fine. Basically, I want to be
> able
> > to use a shell script to copy a tarball from the
> > remote PC to my backup PC. When I enter these
> commands
> > in manually, everything works.
> >
> > 1. su backup
> > 2. scp
> > support.mycompany.com:/home/backup/support.tar.gz
> > /home/backup/cur_support.tar.gz
> > 3. exit
> >
> > This takes a few minutes as the tarball is 12 mb.
> >
> > However, when I put these commands in a shell
> script
> > and run it, the tarball is not copied and I remain
> on
> > the remote pc. Here is my shell script:
> 
> 
> Your script only executes to the su command. The su
> command spawns a new 
> shell, which doesn't know nothing about the script
> that launched it. 
> Therefor, it doesn't execute the remaining commands.
> 
> To run a script with another user priviledges, you
> could try:
> 
> su -c backup yourscriptname
> 
> and remove the su line from the script.
> 
> - -- 
> Hugo Chasqueira
> 
> PGP Key:
>
http://search.keyserver.net:11371/pks/lookup?op=get&search=0x8BD14B82&template=netenextract
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.7 (GNU/Linux)
> 
>
iD8DBQE+b7a+jFeRi4vRS4IRAsAEAJ4hI6clyyq2CVCQF9MKcnP4dqWFWwCfV/zQ
> FF+PIDMNlimuZWlM6o3klpE=
> =PzAg
> -----END PGP SIGNATURE-----
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com


More information about the Techtalk mailing list