Showing posts with label gksu. Show all posts
Showing posts with label gksu. Show all posts

Wednesday, 17 December 2014

Reconnecting With Your SSH Server after an Upgrade

I recently got around to updating my file server's operating system (from Mint 16 to Mint 17) and, in accordance with the law of unintended consequences, I found that I could no longer access my files using secure shell!

What I did get was an error message telling me that the host key verification [test had] failed. When you think about it, I should have anticipated the problem, after all, the original key was hashed under a different implementation of SSH Server as well as a different operating system! Fortunately, the fix is quite simple, particularly if you're only connecting to one host.

For a Single Host


Navigate to to the .ssh folder in the home/username directory (username will be unique to your circumstances). Remember that the period (full stop) indicates that this is a hidden folder, so you should ensure that you have the Show Hidden Files option enabled in your file browser. Delete the known_hosts file in the .ssh directory.

Now reconnect with your SSH host and a new key will be created following the usual warning that this is a new (and unknown!) host.

For Multiple Hosts

The error message will identify a line number in the know_hosts file; make a note of the number and open a terminal:

gksu gedit /home/username/.ssh/known_hosts

You will be prompted for your password. When the file is opened, delete the offending line, save the file and reconnect with your server. You should be prompted to recreate the key as if this were a first connection.

If you accidentally delete the wrong line (or the whole file, for that matter), fear not, the individual keys will be recreated when you next connect to your SSH server(s).

Sources & Resources:

  • None

Sunday, 11 May 2014

DELL 6400 Integrated Card Reader & Ubuntu (sudo v gksu)

I've written on getting the integrated card reader to work on my Inspiron 6400 before. After changing/re-installing my operating system, this is one of those important/non-urgent jobs that gets done when I need to read a memory card (& usually not before!). However, I have noticed that the fix that I posted last July doesn't persist: that is, if I unmount a card, I can't (always) mount another without rebooting my laptop.

There's a good reason for this: I didn't understand that you should never launch a graphical application from the terminal using the sudo command.

"You should never use normal sudo to start graphical applications as Root. You should use gksudo (kdesudo on Kubuntu) to run such programs. gksudo sets HOME=~root, and copies .Xauthority to a tmp directory. This prevents files in your home directory becoming owned by Root. "
[Source]

It seems that when running a graphical application via the sudo command, the application is granted root privilege but utilizes the users configuration file. Therefore, best practise dictates that, when opening graphical applications with administrator privilege, you should invoke the application using the gksu command.

So, I'm compelled to revise my advice for fixing the integrated card reader on the Inspiron 6400. Open a terminal & then:

gksu gedit /etc/modules

Instead of being prompted for your password in the terminal (as you would if you had invoked Gedit using sudo), a administrative dialog will appear requiring your authentication. Enter your password & click OK to open Gedit as root.

When Gedit opens, add the following code to the bottom of the file:

sm_ftl

This is a better solution than the one posted last year but it is not completely effective (delayed unmounts will sometimes result in a return of the problem behaviour). However, maintaining focus on the file manager whilst swapping out cards generally displays fix persistence.

Sources & References: