3

So I have set up port forwarding on my router and have a public IP address for my raspberry pi. I can see the default webpage and it works great.

Now I want to actually create a FTP so that I can change the files on my web server. I have tried various tutorials but they all seem to be for local work. And I seem to lock myself out of the folders I need.

Any help would be great. I just want to change the index file in the /var/www directory while logged into my FTP with my public IP address from my Pi.

asked Oct 8, 2015 at 16:11
1
  • 1
    For ftp you need to forward port 21. I wouldn't open port 21 on my router tho. Ftp is a very old and very insecure protocol. Password travel the Internet in clear text. Random port scanners that "drive by" your IP may try a brute force attack. Better to use ssh, or perhaps SFTP. Commented Oct 9, 2015 at 2:59

2 Answers 2

2

If you want to use FTP cross network, then you need to forward port 20. If you want to use SFTP cross network then forward port 22. SFTP is extremely simple if you already use SSH. If you need FTP, and not SFTP, follow this tutorial here: https://www.youtube.com/watch?t=1&v=r0BoBkv3cwg

answered Oct 9, 2015 at 17:09
3

If you've enabled SSH (easily done with raspi-config), then you ought to be able to use SFTP.

$ sftp [email protected]
Connected to 192.168.0.2.
sftp> pwd
Remote working directory: /home/pi

If you're having permissions problems on /var/www you'll need to make sure the pi user can read-write.

$ sudo chown -R pi:pi /var/www
$ ls -la /var/www
total 40
drwxr-sr-x 6 pi pi 4096 Oct 8 19:19 .
drwxr-xr-x 12 root root 4096 Sep 22 09:59 ..
-rw-r--r-- 1 pi pi 2928 Oct 8 19:19 index.html
answered Oct 9, 2015 at 14:03
3
  • 1
    If you choose ssh, you will need to forward port 22 Commented Oct 9, 2015 at 14:16
  • Yea, I have SFTP a;ready set up. I believe it comes standard. But the SFTP is only local. I'm trying to access my web servers files remotely. I would be able access it remotely with SFTP and setting those permissions? Also, I already have the port forwarding setup for the FTP but I haven't for the SSH. If I do so will this allow remote access under SFTP? Commented Oct 9, 2015 at 15:38
  • Listen to @nachito. Don't use plain FTP, it's not secure. Forwarding port 22 from your router to your Pi will enable outside access for not SSH and SFTP. Commented Oct 9, 2015 at 22:51

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.