LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-19-2019, 07:58 AM   #1
ddenial
Member
 
Registered: Dec 2016
Distribution: CentOS, Fedora, Ubuntu
Posts: 359

Rep: Reputation: 56
FTP - ftp into subfolder


Hello

I've created ftp server and copied CentOS 7 ISO files into /var/ftp/pub/cent folder.

In a web browser, if I enter address 'ftp://192.168.1.7/pub/cent', I'll be displayed with the list of files. However, if I enter the same in the terminal, I get the error.

Code:
# ftp ftp://192.168.1.7/pub/cent
ftp: ftp://192.168.1.7/pub/cent: Name or service not known
ftp> 

# ftp 192.168.1.7/pub/cent
ftp: 192.168.1.7/pub/cent: Name or service not known
But if I ftp to root folder, I'll be logged in.
Code:
# ftp 192.168.1.7
Connected to 192.168.1.7 (192.168.1.7).
220 (vsFTPd 3.0.2)
Name (192.168.1.7:root): anonymous
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd pub/cent
250 Directory successfully changed.
ftp> ls
227 Entering Passive Mode (192,168,1,7,136,204).
150 Here comes the directory listing.
-rw-rw-r--    1 0        0              14 Nov 25 16:01 CentOS_BuildTag
drwxr-xr-x    3 0        0              35 Nov 25 16:20 EFI
-rw-rw-r--    1 0        0             227 Aug 30  2017 EULA
-rw-rw-r--    1 0        0           18009 Dec 09  2015 GPL
drwxr-xr-x    2 0        0              43 Nov 25 16:20 LiveOS
drwxrwxr-x    2 0        0          221184 Nov 25 23:52 Packages
-rw-rw-r--    1 0        0            1690 Dec 09  2015 RPM-GPG-KEY-CentOS-7
-rw-rw-r--    1 0        0            1690 Dec 09  2015 RPM-GPG-KEY-CentOS-Testing-7
-r--r--r--    1 0        0            2883 Nov 25 23:54 TRANS.TBL
drwxr-xr-x    3 0        0              57 Nov 25 16:21 images
drwxr-xr-x    2 0        0             198 Nov 25 16:20 isolinux
drwxrwxr-x    2 0        0            4096 Nov 25 23:53 repodata
226 Directory send OK.
ftp>
How do I ftp directly into /var/ftp/pub/cent folder?

Thanks
 
Old 05-19-2019, 08:52 AM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
I think that your ftp client expects an IP address or hostname as argument, not a URL.

You could try
Code:
curl 192.168.1.7/pub/cent
 
Old 05-19-2019, 10:52 AM   #3
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Quote:
Originally Posted by ddenial View Post
How do I ftp directly into /var/ftp/pub/cent folder?

Thanks
Maybe
Code:
ftp 192.168.1.7 !cd /pub/cent
(untested)

See man ftp

I'm pretty sure you'll have to execute a cd command at some point after login...that's just how ftp works. The command above simple queues the cd command.

Last edited by scasey; 05-19-2019 at 10:53 AM.
 
Old 05-19-2019, 05:27 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
lftp client has a lot more capability then ftp.

Code:
lftp -e "cd pub/cent" 192.168.1.7
Ultimately it depends on what you are trying to accomplish. ftp can be used in a shell script for batch commands as well as lftp.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
importing a bookmarks file into a bookmarks subfolder newbiesforever Linux - Software 0 11-07-2006 09:54 PM
mount a subfolder of /hda2 hypoglycemic Linux - Software 2 11-16-2004 05:27 AM
Nautilus: Unlocking Subfolder and Files bezaleel Fedora 1 07-04-2004 09:33 AM
Getting mail to subfolder pembo13 Linux - Software 0 11-22-2003 05:38 AM
folders/subfolder permissons demmylls Linux - General 1 11-22-2003 05:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration