# Change file permissions via FTP

**URL:** <https://www.ruby-forum.com/t/change-file-permissions-via-ftp/169510>\
**Category:** Ruby\
**Created:** [June 4, 2009, 6:25pm UTC](https://www.ruby-forum.com/t/change-file-permissions-via-ftp/169510 "2009-06-04T18:25:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeanluca](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/74df32/32.png) [@jeanluca](https://www.ruby-forum.com/u/jeanluca)\
**Post date:** [June 4, 2009, 6:25pm UTC](https://www.ruby-forum.com/t/change-file-permissions-via-ftp/169510/1 "2009-06-04T18:25:25Z")

</div>

Hi,

I have to upload a file via FTP and then change its permissions, i’m  
using  
net/ftp but i don’t know how to change the perms.  
How can I do that?  
Should I use another library?

Thanks in advance.

Luca

---

<div class="post-metadata">

**Author:** ![jeanluca](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/74df32/32.png) [@jeanluca](https://www.ruby-forum.com/u/jeanluca)\
**Post date:** [June 8, 2009, 1:40pm UTC](https://www.ruby-forum.com/t/change-file-permissions-via-ftp/169510/2 "2009-06-08T13:40:42Z")

</div>

- Luca S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi,
> 
> I have to upload a file via FTP and then change its permissions, i’m  
> using  
> net/ftp but i don’t know how to change the perms.  
> How can I do that?

Not tested, but have you tried something like this?

Net::FTP.open(host) do |conn|  
\< login/chdir/upload code here \>  
response = conn.sendcmd(“SITE CHMOD 0664 #{filename}”)  
end

---

<div class="post-metadata">

**Author:** ![jeanluca](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/74df32/32.png) [@jeanluca](https://www.ruby-forum.com/u/jeanluca)\
**Post date:** [June 8, 2009, 2:09pm UTC](https://www.ruby-forum.com/t/change-file-permissions-via-ftp/169510/3 "2009-06-08T14:09:50Z")

</div>

Lars H. wrote:

> - Luca S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Hi,
> > 
> > I have to upload a file via FTP and then change its permissions, i’m  
> > using  
> > net/ftp but i don’t know how to change the perms.  
> > How can I do that?
> 
> Not tested, but have you tried something like this?
> 
> Net::FTP.open(host) do |conn|  
> \< login/chdir/upload code here \>  
> response = conn.sendcmd(“SITE CHMOD 0664 #{filename}”)  
> end

Thanks Lars,  
I’ve tried your suggestion and it works. It solved my problem.
