Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Net::SSH::Perl - How to set remote default file permissions

Reply
Thread Tools

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

 
 
Joe
Guest
Posts: n/a
 
      12-13-2007
When I manually execute a script with Net::SSH:erl 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
 
Reply With Quote
 
 
 
 
Joe
Guest
Posts: n/a
 
      12-14-2007
On Dec 13, 12:53 pm, Joe <(E-Mail Removed)> wrote:
> When I manually execute a script with Net::SSH:erl 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
 
Reply With Quote
 
 
 
 
J. Gleixner
Guest
Posts: n/a
 
      12-14-2007
Joe wrote:
> On Dec 13, 12:53 pm, Joe <(E-Mail Removed)> wrote:
>> When I manually execute a script with Net::SSH:erl 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'");


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

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
In-depth documenation on User Permissions, Group Permissions, ACLs, DCLs etc. Curt K ASP .Net 0 11-03-2006 04:54 PM
ASPX file returning obscur runtime error - after changing permissions to a subweb (.net app) to different permissions than on its parent ? Isabelle ASP .Net 0 08-11-2004 02:04 PM
Re: Permissions - giving "everyone" full permissions is bad ? Scott Allen ASP .Net 0 07-13-2004 08:54 PM
Setting folder permissions on remote machine / remote domain Tim Chandler ASP .Net Security 0 10-07-2003 04:17 PM



Advertisments