T
timothy.hill
Hi,
I am in the process of writing a script that puts files on a remote
unix box from a windows machine (I am also using Net::SSH::W32Perl). It
is important that these files are placed in the correct directory and
if that directory does not exist, it must be created with the correct
permissions (777). For this I am using the do_mkdir() function. I am
able to create the directory fine, but I just cannot get the
permissions to set correctly - I have put loads of different numbers
into this, but have been able to get anything but rwxrwxrwx on the
directory. The code I have hacked for this bit is:
my $attrs = new Net::SFTP::Attributes();
$attrs->flags(15);
$attrs->size(4096);
$attrs->uid($ftp_info{$user}->{'uid'});
$attrs->gid($ftp_info{$user}->{'gid'});
$attrs->perm(16895);
$attrs->atime(time);
$attrs->mtime(time);
$sftp->do_mkdir($remote_dir, $attrs);
The 16895 value you see is the mode value I have obtained from doing a
stat on a directory that has the required permissions, but running this
code only produces drwxr-xr-x premissions. This is driving me potty -
can anyone help?
Cheers
Tim
I am in the process of writing a script that puts files on a remote
unix box from a windows machine (I am also using Net::SSH::W32Perl). It
is important that these files are placed in the correct directory and
if that directory does not exist, it must be created with the correct
permissions (777). For this I am using the do_mkdir() function. I am
able to create the directory fine, but I just cannot get the
permissions to set correctly - I have put loads of different numbers
into this, but have been able to get anything but rwxrwxrwx on the
directory. The code I have hacked for this bit is:
my $attrs = new Net::SFTP::Attributes();
$attrs->flags(15);
$attrs->size(4096);
$attrs->uid($ftp_info{$user}->{'uid'});
$attrs->gid($ftp_info{$user}->{'gid'});
$attrs->perm(16895);
$attrs->atime(time);
$attrs->mtime(time);
$sftp->do_mkdir($remote_dir, $attrs);
The 16895 value you see is the mode value I have obtained from doing a
stat on a directory that has the required permissions, but running this
code only produces drwxr-xr-x premissions. This is driving me potty -
can anyone help?
Cheers
Tim