FTP Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
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:
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  
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: 7
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: 7
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: 7
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


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

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

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





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway