FTP Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsSystem AdministrationFTP Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 30th, 2001, 03:15 PM
lustyx lustyx is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Posts: 25 lustyx User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Chmod using FTP

Does anyone know of a way to use an FTP module to chmod file permissions on remote files?

Reply With Quote
  #2  
Old May 31st, 2001, 11:44 AM
footinmouth footinmouth is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Location: North Vancouver, BC, Canada
Posts: 44 footinmouth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 12
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

Reply With Quote
  #3  
Old May 31st, 2001, 12:05 PM
footinmouth footinmouth is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Location: North Vancouver, BC, Canada
Posts: 44 footinmouth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 12
Post Link for Net::Ftp module readme

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;

Reply With Quote
  #4  
Old May 31st, 2001, 02:31 PM
footinmouth footinmouth is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Location: North Vancouver, BC, Canada
Posts: 44 footinmouth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 12
Post Ftp example with color comments

#!/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

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationFTP Help > Chmod using FTP

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap