Site-wide Tags:  Linux(17) | CommandLine(12) | Ubuntu(10) | RemoteAccess(7) | Tools(7) | Vim(7) | LiftWeb(5) | SBT(5) | SoftwareDev(5) | Mac(5) | Scripts(4) | WebDev(4) | Diagrams(4) | Lifty(3) | NetworkDrives(3) | Processwire(3) | Security(3) | Fog(3) | VCS(3) | BestPractices(3) | RaspberryPi(2) | WebDesign(2) | Encryption(2) | Windows(2) | SSH(2) | WinCommandPrompt(2) | GitHubRepos(2) | Emacs(2) | PHP(2) | IDE(2) | ErrorMsgs(2) | JVM(2) | Hardware(2) | Bash(2) | Networks(2) | Graphviz(2) | Cloning | Cygwin | Graphics | Java | SystemRecovery | lessc | Maven | Python | PXE | Samba | LXDE | PackageManagement | LifeHacks | LESS |

This site has been archived and will no longer be updated.
You can find my new homepage at neilpahl.com.

Mount FTP Location Into Local Folder Without Exposing Password

Tags:  Ubuntu   Linux   RemoteAccess   WebDev   BestPractices   
Created on Wed, 14 Mar 2012.
Last Modified on Fri, 20 Apr 2012.

Motivation Behind This Cheatsheet

It's a lot nicer to upload/download files when they are mounted into your filesystem

The Cheatsheet

curlftpfs can be downloaded, and built from source from their sourceforge site, but on ubuntu its easy enough to just

sudo apt-get install curlftpfs

create a folder which will act as a symlink to the remote ftp (recomend in your ~ directory so you dont have to use sudo to access /mnt/)

mkdir /path/to/my/folder

then you can temporarily (untill restart or power down) mount that location using

curlftpfs ftp_un:[email protected]_of_ftp /path/to/my/folder


Now, the above is not that great because you never want to type cleartext passwords in the command line. They get stored into the command history and could be potientially seen by other users. Even though FTP isn't that safe in the first place (passwords and everything get transmitted in cleartext), we don't want to make matters worse. I would never use ftp if i did't have to, haha.

With smb mounts, we should use a credential file. similarly, with curlftp mounts we will use the /root/.netrc file


we can create a /root/.netrc file to hold our ftp credentials:

sudo vi /root/.netrc

and put the following in it:

machine address_of_ftp
login ftp_un
password ftp_pw

then change the permissions so that noone can read it:

sudo chmod 600 /root/.netrc

check your uid and gid with

id

in this case, my uid is 1000 and gid is 1000

and in the /etc/fstab file, add the line:

curlftpfs#address_of_ftp /path/to/my/folder fuse allow_other,uid=1000,gid=1000,umask=0022 0 0

Since its in the fstab, it will mount when we restart. If we want to mount it right away, use:

sudo mount -a

and you are done!



PLEASE let me know if I'm doing something wrong, or if you have any suggestions or requests~

blog comments powered by Disqus