LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-26-2022, 08:29 AM   #1
HannemanThrashKing
Member
 
Registered: Oct 2017
Location: Canada
Distribution: Ubuntu MATE
Posts: 35

Rep: Reputation: Disabled
Question Terminal command too long and the part ending up in the second line causes a bash error


I'm trying to mount my remote server using curlftpfs but I get a stupid error because the password is too long in the command

Code:
# curlftpfs ftp.example.com /mnt/ftp/ -o ssl,user=username:password
even with the window maximized, now I know this can be solved with \ or / but I rarely ever did that myself in 10 years of linux usage, I'm not a newbie, but whenever those showed up in tasks I had to do, I would be copypasting them from a website.

I know it's because the password is too long for the window because I get thrown the last characters of the password in the error following entering the command :

Code:
bash: ******: event not found
I hid the characters even if its a randomly generated 64 characters password, you never know

How can I correct this exactly?
 
Old 01-26-2022, 08:39 AM   #2
boughtonp
Senior Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 3,599

Rep: Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546

I suspect it's not length, but presence of ";" (or another Bash metacharacter) causing it to be interpreted as a new command.

Either way, the solution is to wrap the password in single quotes to ensure all characters are treated as literals.

 
Old 01-26-2022, 08:40 AM   #3
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,670

Rep: Reputation: Disabled
Rather than on command line, username and password for curlftpfs could be specified in ~/.netrc:
Code:
machine ftp.example.com login username password yourlongpassword
The file must be readable only by owner, or it won't be accepted.
Code:
$ stat -c%A ~/.netrc
-rw-------

Last edited by shruggy; 01-26-2022 at 08:49 AM.
 
Old 01-26-2022, 10:38 AM   #4
HannemanThrashKing
Member
 
Registered: Oct 2017
Location: Canada
Distribution: Ubuntu MATE
Posts: 35

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by boughtonp View Post
I suspect it's not length, but presence of ";" (or another Bash metacharacter) causing it to be interpreted as a new command.

Either way, the solution is to wrap the password in single quotes to ensure all characters are treated as literals.

thanks! I forgot I can do this, I do it often when using dnuos -L 'folder name of album' when looking at bitrates

I wonder if it will think the single quotes are part of the password now though, I'll check back soon and tell you when I get back home and do it.

Last edited by HannemanThrashKing; 01-26-2022 at 10:40 AM.
 
Old 01-26-2022, 11:07 AM   #5
boughtonp
Senior Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 3,599

Rep: Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546
Quote:
Originally Posted by HannemanThrashKing View Post
I wonder if it will think the single quotes are part of the password now though
It wont, because it doesn't see them - everything you type into the shell is interpreted by the shell and split into individual components ("words") before identifying which of those words are commands and which are arguments and eventually executing the relevant programs with arguments. The single quotes instruct the shell not to perform that splitting within them, so their enclosed text is treated as a single unit, but the quotes are essentially consumed during this step; they do not get passed through to the command.

See https://www.gnu.org/software/bash/manual/html_node/Shell-Operation.html

Another way to avoid word splitting is to put the password in a config file, as in Shruggy's post, which is a better option (though if you can use certificates and disable password logins that's even better).


Last edited by boughtonp; 01-26-2022 at 11:13 AM.
 
Old 01-27-2022, 04:02 AM   #6
HannemanThrashKing
Member
 
Registered: Oct 2017
Location: Canada
Distribution: Ubuntu MATE
Posts: 35

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by boughtonp View Post
It wont, because it doesn't see them - everything you type into the shell is interpreted by the shell and split into individual components ("words") before identifying which of those words are commands and which are arguments and eventually executing the relevant programs with arguments. The single quotes instruct the shell not to perform that splitting within them, so their enclosed text is treated as a single unit, but the quotes are essentially consumed during this step; they do not get passed through to the command.

See https://www.gnu.org/software/bash/manual/html_node/Shell-Operation.html

Another way to avoid word splitting is to put the password in a config file, as in Shruggy's post, which is a better option (though if you can use certificates and disable password logins that's even better).

Turns out it's true, curlftpfs worked, but the mnt/ftp/ folder is not recognized as a folder in Caja, I'll try to get in there through terminal but if it doesn't work with the gui, then all reasons I wanted to try curlftpfs for are nullified and I might just as well connect through Caja like with Nautilus. It's apparently faster to use curlftpfs than ssh/sftp hence why I'm going this route. I will consider Shruggy's post once I get this working right from my vps's own instructions wiki though.
 
  


Reply

Tags
20.04, command prompt, terminal, ubuntu mate



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
[SOLVED] cant fix: "CLEAR: command not found" when trying to execute in terminal. "CLEAR" is part of code not the command to wipe the terminal screen Kintaro Linux - Newbie 12 08-03-2020 04:27 PM
[SOLVED] Delete from second part of each line and go to next line sam@ Linux - Newbie 4 02-14-2016 07:30 PM
LXer: My Nerd Life: Too Loud, Too Funny, Too Smart, Too Fat LXer Syndicated Linux News 0 01-24-2014 05:21 AM
long long long: Too long for GCC Kenny_Strawn Programming 5 09-18-2010 01:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:33 AM.

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