Erninnjo
Posts: 11
Joined: Tue Jul 11, 2017 4:26 pm

FTP server

Mon Oct 09, 2017 3:51 pm

Hi guys!

I have a big trouble and i would require some fast help i hope it can be done. :oops:

I just try to follow the instructions in
https://www.raspberrypi.org/documentati ... ess/ftp.md
site to set up an FTP server. The first problem is that i am kinda new boy to linux and terminals and so on, but the second problem is my Pi writes an err msg at the very first command.

'sudo apt-get install pure ftpd' com ends with
'E: unable to locate package pure ftpd'

i assume it is not what i shall see... pls provide some help.

Regards

User avatar
B.Goode
Posts: 8514
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: FTP server

Mon Oct 09, 2017 3:54 pm

Welcome to the Raspberry Pi forums.



The first instruction in the resource you referenced is

Code: Select all

sudo apt-get install pure-ftpd
That " - " in the name of the package is significant, you cannot omit it.

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: FTP server

Mon Oct 09, 2017 3:56 pm

Why not use something secure, like sftp? It is installed by default. Uses SSH port.

Erninnjo
Posts: 11
Joined: Tue Jul 11, 2017 4:26 pm

Re: FTP server

Mon Oct 09, 2017 4:08 pm

B.Goode wrote:
Mon Oct 09, 2017 3:54 pm
Welcome to the Raspberry Pi forums.



The first instruction in the resource you referenced is

Code: Select all

sudo apt-get install pure-ftpd
That " - " in the name of the package is significant, you cannot omit it.
Thank You B.Goode,
Well i really missed the hypen* on forum but not on cmdline, but anyway it is working with copy, paste, thanks, maybe i ll post later if have some more troubles.
SurferTim wrote: Why not use something secure, like sftp? It is installed by default. Uses SSH port.
Because as i told i am a very very beginner... :roll: and did not found any detailed documentation about sftp (i mean that under 'help' tab do a single search and no sftp, but i managed to find ftp docs linked abowe)

Erninnjo
Posts: 11
Joined: Tue Jul 11, 2017 4:26 pm

Re: FTP server

Mon Oct 09, 2017 4:42 pm

Sorry guys, now i found sftp documentations, it is really more simple, however i have further questions.

#1:
I want to reconfigure that somehow to navigate to another directory than /home/pi

#2:
How can i make this folder available from a totally different network (mainly via WAN)

#3:
how can i add a guest user who can manage the 'shared' folder but not with my root login and pw ofc?

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: FTP server

Mon Oct 09, 2017 4:47 pm

Enter separate user/passwords with their own home directories.

Code: Select all

useradd -m user
Then you login just like ssh.

Code: Select all

sftp user@192.168.1.2

Erninnjo
Posts: 11
Joined: Tue Jul 11, 2017 4:26 pm

Re: FTP server

Mon Oct 09, 2017 4:50 pm

And if the shared folder supposed to be an external HDD device? :shock: :?
somehow to call /media/...

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: FTP server

Mon Oct 09, 2017 4:52 pm

Then don't use the -m option.
I create a symlink to /home/user from the hdd.

Erninnjo
Posts: 11
Joined: Tue Jul 11, 2017 4:26 pm

Re: FTP server

Mon Oct 09, 2017 5:10 pm

i created a new user for now with '-m' but how can i add pw to it? when i try to connect from a total commander it asks me pw as well and leaving it blank makes an error msg.


and how i create symlink that navigates from user to hdd?

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: FTP server

Mon Oct 09, 2017 5:29 pm

Code: Select all

sudo passwd user
Then enter new password twice.

Create a directory for your user on your HDD with your user as owner.
sudo ln -s /media/hddname/user /home/

Martin Frezman
Posts: 1020
Joined: Mon Oct 31, 2016 10:05 am

Re: FTP server

Mon Oct 09, 2017 6:00 pm

Since we seem to have been successful in moving you from old-fashioned (and insecure) FTP to the new way of ssh, let me put in a plug here for sshfs. sshfs is like samba or nfs, but is based on an ssh connection. It requires Linux on the client side, but works with any SSH server (needs ssh version 2 - but that is pretty standard nowadays) on the server side.

It works perfectly on LANs - but is somewhat spotty over a WAN - it does work, but sometimes needs to be "jiggled" to keep the connection alive. But it does work.
If this post appears in the wrong forums category, my apologies.

Erninnjo
Posts: 11
Joined: Tue Jul 11, 2017 4:26 pm

Re: FTP server

Mon Oct 09, 2017 7:06 pm

Guys i am afraid that i really don know what u re talking about!!

i just started an FTP server then came to change to sftp... then i asked how to reconfigure it, and just got some half command from where i do not know where and when to use them, now came a really brand new idea about ssh based i dont know what...

guys I AM A BEGINNER, totally unfamiliar with coding...

i can only understand commanding like in the pagewhen everything is detailed
( https://www.raspberrypi.org/documentati ... ess/ftp.md)

i just want to set up a kinda server which looks like:
"my group of people, called friends, from all over the country grab their total commander, type the little stuffs in ftp gadget, and then they get to my external HDD's defined folder with read and write permissions!"

then how should i proceed...?

i tried sth from basic ftp guide:
"sudo chown -R ftpuser:ftpgroup /media/pi/HDD/directory"
but "operation not permitted" and it lists it for all the files already existing in that folder (!?)

please... if u intend to really help me pls do in a way I can understand. ty

jahboater
Posts: 4680
Joined: Wed Feb 04, 2015 6:38 pm

Re: FTP server

Mon Oct 09, 2017 7:42 pm

Erninnjo wrote:
Mon Oct 09, 2017 7:06 pm
please... if u intend to really help me pls do in a way I can understand. ty
I'm surprised no one has mentioned scp. Scp as its name implies (secure copy) acts much like the "cp" command. It is very simple to use and doesn't need to be installed. With a bit of configuration effort (two commands) you don't even need to give a password every time.

scp myfile pi@host:

copies "myfile" to the home directory of user pi on machine "host".

scp pi@host:/boot/config.txt .

copies the config.txt file on the Pi to the current directory of the PC you are on.

User avatar
B.Goode
Posts: 8514
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: FTP server

Mon Oct 09, 2017 7:53 pm

i just want to set up a kinda server which looks like:
"my group of people, called friends, from all over the country grab their total commander, type the little stuffs in ftp gadget, and then they get to my external HDD's defined folder with read and write permissions!"


We can't solve the requirement of "all over the country". That is out of the control of your RPi. It will most likely require modification to the configuration of your home broadband internet router. If you don't have administrator rights to that device, or the confidence to modify it, there might not be any point proceeding any further.

Erninnjo
Posts: 11
Joined: Tue Jul 11, 2017 4:26 pm

Re: FTP server

Tue Oct 10, 2017 11:59 am

B.Goode wrote:
Mon Oct 09, 2017 7:53 pm



We can't solve the requirement of "all over the country". That is out of the control of your RPi. It will most likely require modification to the configuration of your home broadband internet router. If you don't have administrator rights to that device, or the confidence to modify it, there might not be any point proceeding any further.
The biggest difficulty for me in programming is that i dont see anything understandable in the command lines...
A router device fortunately has a sort of interface where i can read informations, basic instructions, and i can see maybe options as well. Therefore i managed to configure my router to assign a permanent IPaddress to my pi's MAC address, and i also opened a port (i suppose it is opened, the exact tab name was 'Port forwarding') to the pi address. I opened port 22 and 21 as well for both TCP and UDP.

I also use a link to determine my global IPaddress:
http://www.myipaddress.com/what-is-my-ip-address/

and another one to test globally the FTP but just having error msgs.
https://ftptest.net/#result
jahboater wrote: I'm surprised no one has mentioned scp. Scp as its name implies (secure copy) acts much like the "cp" command. It is very simple to use and doesn't need to be installed. With a bit of configuration effort (two commands) you don't even need to give a password every time.

scp myfile pi@host:

copies "myfile" to the home directory of user pi on machine "host".

scp pi@host:/boot/config.txt .

copies the config.txt file on the Pi to the current directory of the PC you are on.
To tell the truth i dont really want to just copy the files to the pi's home folder cause the pi is working on a 8GBsd card. And my datas are tons above that sieze...

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: FTP server

Tue Oct 10, 2017 12:04 pm

The problem with FTP is it requires two channels to transfer data. One is the command channel (normally port 21), and the other is the data channel (port). Port forwarding to a FTP server through a router is difficult at best.

Martin Frezman
Posts: 1020
Joined: Mon Oct 31, 2016 10:05 am

Re: FTP server

Tue Oct 10, 2017 12:21 pm

SurferTim wrote:
Tue Oct 10, 2017 12:04 pm
The problem with FTP is it requires two channels to transfer data. One is the command channel (normally port 21), and the other is the data channel (port). Port forwarding to a FTP server through a router is difficult at best.
Exactly.

This is very high on the list of reasons why you shouldn't do this (and by "this", I mean "use FTP"). One of the many nice things about ssh is that it only uses one simple, unidirectional, port.

Once again: The answer here is 'sshfs'. Sing it loud! Sing it proud!
If this post appears in the wrong forums category, my apologies.

Erninnjo
Posts: 11
Joined: Tue Jul 11, 2017 4:26 pm

Re: FTP server

Tue Oct 10, 2017 4:36 pm

Okay then continue with SSH which is built in rasbpi and secure.

Now i want to ask u for exact codes, to delete the existing SSH service, and create a new, which starts on directory /media/pi/externalHDD when someone connect to it. And also maintain another 'guest' user login option to that SSH and pls tell me how to reconfigure the router porting to that server becaming available throught global IP address.

or

commands how to reconfigure the existing SSH, changing the destination folder, adding new user and so on...

if not codes, a site link where it is written down precisely

jahboater
Posts: 4680
Joined: Wed Feb 04, 2015 6:38 pm

Re: FTP server

Tue Oct 10, 2017 5:13 pm

Erninnjo wrote:
Tue Oct 10, 2017 11:59 am
To tell the truth i dont really want to just copy the files to the pi's home folder cause the pi is working on a 8GBsd card. And my datas are tons above that sieze...
scp myfile pi@host:/media/pi/mysdcard

You can of course copy files to or from anywhere on your Pi, its trivially simple.

Martin Frezman
Posts: 1020
Joined: Mon Oct 31, 2016 10:05 am

Re: FTP server

Tue Oct 10, 2017 6:29 pm

Amplifying on the previous post...

There are basically two ways to do this, based on the 'ssh' protocol. But, as you've noted, the first thing is to get ssh itself going between your server (the pi) and your client(s) (people out there on the Internet). Other people have hinted at how to do this - It's called "Port Forwarding" - but we can't really be any more specific, because it is based on your router and every router is different. You'll have to figure this part out on your own.


Next, you'll have to figure out your user management. I.e., figure out which user you want your clients to come in as, and give them the id and password information. You'll need to set things up securely on your end, so that they have as much access as they need, but no more. Once you've got this setup - so that your users can ssh in and get to a shell prompt on your machine, then you can go on to the next step.

Finally, you get to decide whether you want to go with scp (the simple approach) or with sshfs (which is like Samba or NFS; it means that people will have direct access to your files, without them needing to use any sort of tool to copy them over).

At this point, I'm going to let you think this over, but do definitely check out "man scp" and "man sshfs".
If this post appears in the wrong forums category, my apologies.

Erninnjo
Posts: 11
Joined: Tue Jul 11, 2017 4:26 pm

Re: FTP server

Wed Oct 11, 2017 8:08 am

So u say i should figure out everything for myself... that is exactly how u break down a newcomer's enthusiasm.

Then i say u should have started with this from the very beginning.

Thanks for nothing.

User avatar
B.Goode
Posts: 8514
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: FTP server

Wed Oct 11, 2017 8:19 am

So u say i should figure out everything for myself...
@jahboater has provided you with a simple example as a basis for your solution.

@Martin has pointed out some of the factors that will be specific to your own needs that only you can take the decisions about.

Confusion, frustration, disappointment and embarrassment can cloud judgement - I don't think there is any evidence that you have been told to "figure out everything for myself... "
Last edited by B.Goode on Wed Oct 11, 2017 5:10 pm, edited 1 time in total.

jahboater
Posts: 4680
Joined: Wed Feb 04, 2015 6:38 pm

Re: FTP server

Wed Oct 11, 2017 8:26 am

A long time ago I worked on a help desk in a computer center one morning a week. Often when someone asked a question I would pretend I didn't know the answer and go through the process of looking up the help and finding it out in front of them
The important thing was to teach the person how they themselves could find things out which, in the long run, was far far more useful.

@Martin gave you a long answer and then politely showed you how to look up the manual pages for more info:-
At this point, I'm going to let you think this over, but do definitely check out "man scp" and "man sshfs".
Please don't feel you are "entitled" to anything else, especially as this forum is free and answers come from volunteers.

Erninnjo
Posts: 11
Joined: Tue Jul 11, 2017 4:26 pm

Re: FTP server

Wed Oct 11, 2017 5:07 pm

forget it.

a question:
if sudo blkid shown UUIDs about my extHDD
and then i configure fsdisc adding
'UUID=(#partitionUUID) /media/.......

then why it sands back after a 'mount /media/.....'
cant find UUID=(#....)?

Erninnjo
Posts: 11
Joined: Tue Jul 11, 2017 4:26 pm

Re: FTP server

Wed Oct 11, 2017 5:27 pm

never mind
my os just crashed to hell
best wishes folks, pls delete my thread, bb

Return to “Troubleshooting”