You are not logged in.

#1 2010-07-04 20:52:36

kiruch
Member
From: Saint-Petersburg, Russia
Registered: 2009-06-30
Posts: 22
Website

How to connect to an FTP server via Midnight Commander _User_Menu_?

Hi everyone.

There's a nifty command that works in MC and makes it connect to an FTP server and display its directories just as if they were local ones: cd ftp://USER_LOGIN@SERVER_NAME. The only thing it asks for is a password, obviously. That's exactly what i'm looking for, theoretically.
I know it's not really a standard Bash command, because if invoked outside MC, it returns an error (directory not found).
I got kind of tired of typing it in (or copypasting it) every time, so i thought why not make it automatic? A Bash alias or a shell script wouldn't work, because as i said, it's not really a bash command.
But what surprised me was that it didn't work as an entry in MC's menu, too.

Tried to go another way, discovered kftp, apparently it's completely not what i am looking for.
And i didn't even understand what F9 > Left > FTP Link in MC did. It isn't automatic as well anyway, i have to type everything in manually.

Can anyone advise how to automate FTP connection in MC, or even in Bash (so that MC just treats it like a regular directory)?
Big thanks in advance.

Last edited by kiruch (2010-07-04 20:53:44)

Offline

#2 2010-07-04 21:36:33

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: How to connect to an FTP server via Midnight Commander _User_Menu_?

Use curlftpfs?

Offline

#3 2010-07-04 21:55:17

mcsilva
Member
From: Portugal
Registered: 2009-12-16
Posts: 95

Re: How to connect to an FTP server via Midnight Commander _User_Menu_?

Create a file named .netrc:

#touch ~/.netrc
#chmod 600 .netrc

Include servers you want with username and passwords in the file created:

machine name_server1 login my_username1 password my_password2
machine name_server2 login my_username2 password my_password2

Then in mc try to connect to server2:
cd ftp://name_server2

Give your feedback please.

Offline

#4 2010-07-05 19:30:57

kiruch
Member
From: Saint-Petersburg, Russia
Registered: 2009-06-30
Posts: 22
Website

Re: How to connect to an FTP server via Midnight Commander _User_Menu_?

lucke, the following command: curlftpfs ftp.0fees.net /ftp/0fees -o user=MYLOGIN:MYPWD gives me an error:
Error connecting to ftp: couldn't connect to host
sad not sure what i'm doing wrong...

mcsilva, here are the contents of my ~/.netrc file: machine ftp.0fees.net login MYLOGIN password MYPWD
When i invoke cd ftp://ftp.0fees.net, it tells me bash: cd: ftp://ftp.0fees.net: No such file or directory
When i invoke it as an entry of MC's menu (what i'm aiming for), i get /tmp/mc-cyril/mcusr6BWdYd: line 2: cd: ftp://ftp.0fees.net: No such file or directory - well, basically the same.
And finally, if i type cd ftp://ftp.0fees.net manually into MC's command prompt, i get a red alert message that says Cannot chdir to "ftp://ftp.0fees.net". Input/output error (5)

I feel like a dumbass... sorry guys smile

Offline

#5 2010-07-05 22:31:05

mcsilva
Member
From: Portugal
Registered: 2009-12-16
Posts: 95

Re: How to connect to an FTP server via Midnight Commander _User_Menu_?

kiruch wrote:

mcsilva, here are the contents of my ~/.netrc file: machine ftp.0fees.net login MYLOGIN password MYPWD
When i invoke cd ftp://ftp.0fees.net, it tells me bash: cd: ftp://ftp.0fees.net: No such file or directory

This is not the correct way. You are using bash command line. For this to work it must be:
# mc cd ftp://ftp.0fees.net

kiruch wrote:

When i invoke it as an entry of MC's menu (what i'm aiming for), i get /tmp/mc-cyril/mcusr6BWdYd: line 2: cd: ftp://ftp.0fees.net: No such file or directory - well, basically the same.

I don't know what do you mean by "invoke an entry of MC's menu",
Is this:
Left->FTP link or Right->FTP link ?

kiruch wrote:

And finally, if i type cd ftp://ftp.0fees.net manually into MC's command prompt, i get a red alert message that says Cannot chdir to "ftp://ftp.0fees.net". Input/output error (5)

In the first post you said you were able to login with "cd ftp://USER_LOGIN@SERVER_NAME", so MC is working well.
This error you showed is the same which I have when I type "cd ftp.0fees.net" in the MC command prompt (maybe you typed wrong...)
Instead, when I try "cd ftp://ftp.0fees.net" the popup error is:  "ftpfs: Login incorrect for user anonymous"
This is what I expected, because I don't have the username and password and I'm trying a anonymous login.
Are you sure your typing is right? Please, check your typing and try again.

Offline

Board footer

Powered by FluxBB