Net::SSH::Perl - How to set remote default file permissions

J

Joe

When I manually execute a script with Net::SSH::perl to run a remote
program, the output file has a permission "660"; When I use a web
server to execute the script (the script uses my user account identity/
pass), the remote output file has a permission "600".

How can I make the script to set a default remote file permission
(like "644") so the web server can read the results back? I tried:
($stdout, $stderr, $exit) = $ssh->cmd("umask 022; script");
and it didn't work.

Thanks in advance!

Joe
 
J

Joe

When I manually execute a script with Net::SSH::perl to run a remote
program, the output file has a permission "660"; When I use a web
server to execute the script (the script uses my user account identity/
pass), the remote output file has a permission "600".

How can I make the script to set a default remote file permission
(like "644") so the web server can read the results back? I tried:
($stdout, $stderr, $exit) = $ssh->cmd("umask 022; script");
and it didn't work.

Well, a reply to myself - I accomplished this by
($stdout, $stderr, $exit) = $ssh->cmd("script; chmod 644 'outfile'");

Joe
 
J

J. Gleixner

Joe said:
Well, a reply to myself - I accomplished this by
($stdout, $stderr, $exit) = $ssh->cmd("script; chmod 644 'outfile'");

Probably better to have 'script' do the chomd, just in case 'outfile'
ever changes within 'script'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top