The Wayback Machine - http://web.archive.org/web/20201029190922/https://github.com/dod38fr/config-model/wiki/Managing-ssh-configuration-with-cme
Skip to content

Managing ssh configuration with cme

Dominique Dumont edited this page Oct 28, 2016 · 7 revisions

This page explains how to use cme to manage ssh configuration. cme supports user ssh configuration (i.e. ~/.ssh/config) or system sshd configuration (i.e. /etc/ssh/sshd_config).

Installation

Debian/Ubuntu

On Debian/Ubuntu:

apt-get install cme libconfig-model-openssh-perl

To get the optional graphical interface, add:

apt-get install libconfig-model-tkui-perl

Others

Run

cpanm App::Cme
cpanm Config::Model::OpenSsh
cpanm Config::Model::TkUI

Usage

Checking your configuration

Simply run cme check ssh:

$ cme check ssh
cme: using Ssh model
loading data
checking data
check done

This command can also be run as root to check /root/.ssh/config

If you want to check /etc/ssh/ssh_config, you must run sudo cme check system-ssh:

$ sudo cme check system-ssh
cme: using SystemSsh model
loading data
checking data
check done

The edit modify and shell commands described below can be applied the same way to system-ssh.

Editing your configuration with a graphical interface

Once you run cme edit ssh, you will see a window like:

TkUI main screenshot

Most of you configuration will probably be in the Host section. This section is open in he screenshot above.

Since ssh features a lot of options, you may want to click on show only custom values button (top right) to hide unmodified configuration values:

TkUI main custom values

The green arrow means that the value is different from the default value. For instance, for host gandal, ForwardAgent is set to 1.

To change a value (e.g. ForwardX11Trusted), you can:

  • right-click on ForwardX11Trusted
  • click on the new checkbox on top right (or click back to default button
  • click on store button

TkUI main edit value

Once, this is done, you need to save the changes to the configuration by clicking on File->save menu.

Edit configuration with a shell like interface

If you have trouble running the graphical interface, you can use a shell like interface by running cme shell ssh command:

$ cme shell ssh
cme: using Ssh model
 >:$ cd Host:gandalf
 >: Host:gandalf $ ll Forward*
name         value        type         comment
ForwardAgent 1            boolean
ForwardX11   1            boolean
ForwardX11Timeout [undef]      uniline
ForwardX11Trusted 1            boolean

 >: Host:gandalf $ set ForwardX11Trusted=0
 >: Host:gandalf $ ll Forward*
name         value        type         comment
ForwardAgent 1            boolean
ForwardX11   1            boolean
ForwardX11Timeout [undef]      uniline
ForwardX11Trusted 0            boolean

 >: Host:gandalf $ changes
Host:gandalf ForwardX11Trusted: '1' -> '0'
 >: Host:gandalf $ quit
 
 Changes applied to ssh configuration:
 - Host:gandalf ForwardX11Trusted: '1' -> '0'
 
 write back data before exit ? (Y/n)y
$

For more details, see the documentation on available commands

common tasks with cme command line

Upgrade your ssh configuration

You can migrate your old ssh configuration file (~/.ssh/config) with the following command:

cme migrate ssh

Note: migration is quite simple: drop old parameters that are now ignored by ssh (e.g. UseRsh and FallBackToRsh.

Upgrade your sshd configuration

You can migrate your old sshd configuration file (/etc/ssh/sshd_config) with the following command:

sudo cme migrate sshd

This command migrates

modification of configuration

You can use the modify subcommand of cme to perform a similar task on the command line:

$ cme modify ssh  Host:gandalf  ForwardX11Trusted=0
cme: using Ssh model

Changes applied to ssh configuration:
- Host:gandalf ForwardX11Trusted: '1' -> '0'

The command used after ssh follows the syntax described in Config::Model::Loader documentation.

More information

You can’t perform that action at this time.