|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Chmod using FTP
Does anyone know of a way to use an FTP module to chmod file permissions on remote files?
|
|
#2
|
|||
|
|||
|
Chmod in FTP example
Try this basic idea :
#!/path_to/perl use Net::FTP; .... after connecting and login ........ $ftp->site("CHMOD 755 NEW.cgi") || die &error("Couldn't chmod NEW.cgi : $!"); ........ other code ....... $ftp->quit; exit; sub error { my ($msg) = shift; # if web based don't forget # print "Content-type: text/html\n\n"; print $msg; $ftp->quit; exit(); } Good Luck Foot in Mouth Ver 1.00 ![]() |
|
#3
|
|||
|
|||
|
Here is a link on Net::FTP for syntax's
http://www.cgi101.com/modules/Net.FTP.html thank's Foot in Mouth Ver 1.00 Post example code, if you get stuck for ++Help; |
|
#4
|
|||
|
|||
|
#!/usr/bin/perl
use Net::FTP; # Net::FTP part of libnet # http://www.cpan.org/authors/id/GBAR...t-1.0703.tar.gz # set up some variables $host = "127.0.0.1"; # local host for this test script $username = "jen"; # Temp user Jenny $password = "jen"; # Her password $Folder = "/home/jen"; # Her home directory where she can write to # Connect $ftp = Net::FTP->new("$host") || die "Could not connect to $host : $!"; # Login $ftp->login("$username","$password") || die "Could not login : $!"; # Do some work -- assumes user can write to folder and use chmod $ftp->cwd("$Folder") || die "Could not cd to $Folder : $!"; # assumes new.cgi right beside ftp.pl in same directory $ftp->put("new.cgi") || die "Could not put new.cgi : $!"; $ftp->site("CHMOD 755 new.cgi") || die "Could not chmod new.cgi : $!"; # Close Connection $ftp->quit; exit; # Tested on Red Hat Linux 7.0, perl 5.6, libnet-1.0703 and temp created user jen # Testing out color coding
__________________
Thanks Foot in Mouth ver 1.2.5 Onion |
![]() |
| Viewing: Dev Shed Forums > System Administration > FTP Help > Chmod using FTP |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|