[clug] Learning mc <- mc

Scott Ferguson scott.ferguson.clug at gmail.com
Thu Apr 9 04:22:20 MDT 2015

On 09/04/15 18:00, Bryan Kilgallin wrote:
> I thank Scott for useful advice.
>> MC -> F9 -> Options -> Panel Options -> Main Options -> Show Hidden
>> Files (unselect)
> I found that, and began learning those options.
> However I found that snippets of text remain across the displayed
> panels. So I have been using "Show full screen"/"Leave full screen" to
> refresh the screen. Is there a simpler or more direct way to clear up
> such visual trash?

I'd find out where those "snippets" are coming from and deal with the
problem at the source. Generally I just open a terminal session, on a
non-gui box just a pseudo-terminal, on a gui box generally konsole
(KDE). My default shell is BASH and I don't get any "snippets".

Perhaps you need to append a "&" to your terminal command?

If all else fails:-

>> Reference: MC -> F1 (Help)
> I have been using this feature, and have figured out how to navigate it.
>>> I used a shell link to my phone. Wherein I had a test text file.
>>> Which I moved to my PC's desktop. At first I saw a list of available
>>> editors, agreeing to the default "nano". But how can I now change
>>> that choice to a different editor?
>> In MC?
> That was my recollection of initially using "mc". What alternatives does
> the "Configuration options: use internal edit" flag switch?

Allows you to use the internal editor (mcedit) instead of the system
default editor (usually the system default is nano). To do this once
only just start mc with:-
EDITOR=mcedit mc

Consult the previously referenced "man update-alternatives" to change
the system defaults (or just check the output of "update-alternatives
--config editor")

>> An MC "shell link"?
> Yes, that's "Left: Shell link...". Which launches the dialogue box
> "Shell link to machine". That asks "Enter machine name (F1 for
> details):". I choose my phone's login (root at phone), and OK. Then "mc"
> launches my default shell: "fish: Waiting for initial line...". I am
> asked for my phone login password, that I supply. The shell window then
> closes, and the "mc" window after a pause lists the phone's filesystem
> root directories in its left panel. I double-click on "/home", then
> "/root", and I'm at the phone user directories list.


*1.* May I suggest on Ubuntu you edit ~/.ssh/config and add an entry like:-
Host $PhoneNickname
        HostName $FQDN
        Port $Whatever
        User $Whoever

        HostName *
        Cipher blowfish-cbc

Replace $PhoneNickname with a nickname for your phone (e.g. p)
Replace $FQDN with the fully qualified domain name of the phone (see
/etc/hosts on Ubuntu for the name)
Replace $Whatever with the default port that the phone listens on for
ssh connections [*1]
Replace $Whoever with the name you login to the phone as (preferably not
Once that's done you can just use the nickname to ssh/scp etc. NOTE:
*all* scp/ssh connections will be encrypted, using the blowfish algorithm.

Example uses if phone nickname is "p":-
ssh p (will create an encrypted connection to the phone)
ssh p "df -h" (will show free space on the phone)
scp /etc/hosts p:/root (will copy /etc/hosts from Ubuntu to the /root
directory of the phone)
in the mc shell link you would just need to type "p" and hit enter

*2.* May I also suggest using a private key instead of insecure password
On Ubuntu as a standard user:-
ssh-keygen (creates a cryptographic keypair for ssh authentication)
ssh-copy-id p (copies your public key to the phone)
ssh p (you'll be asked if the id presented by the phone is authentic -
say yes)
>From then on you won't be asked for passwords to connect the phone *and*
you will be connecting securely. I 'thought' Ubuntu had implemented Best
Practices and forced "no root login" and "no password authentication" by
default... (sigh, mutter)
If you have ssh always listening on port 22 *and* allow both root logins
and password authentication you should at least configure port knocking
or fail2ban to stop brute force attacks. (but given that most people
leave the PIN for their voice mail set to the default last 4 digits of
their phone number I may have unrealistic expectations)

I prefer to use a non-default port for ssh. By default the port is 22.
To check what port the phone uses run either of the following on the phone:-
echo ${SSH_CLIENT##* }
cat /etc/ssh/sshd_config | grep -v "^#" | grep -i ^"port "

To change the port used edit /etc/ssh/sshd_config

*3.* If you find working in a single session frustrating may I suggest
"screen"? It will allow you to open multiple remote sessions - it will
also allow you to resume where you left off if the connection is broken.

Add the following to ~/.bashrc

function sscreen(){
ssh -t "$1" screen -dR

. ~/.bashrc  (possibly redundant?)

After which you can just type (for example):-
sscreen p (and it will start an ssh session with your phone in "screen")

Lots of tutorials on screen at the Google University :)

Kind regards


More information about the linux mailing list