Categotry Archives: ssh

1

Monitoring CPU and Motherboard Temperatures in Linux

by

And so I asked Loni:

is there a way to look at motherboard/cpu temps via an ssh connection?

She said sure!


sudo apt-get install lm-sensors
sudo sensors-detect
sensors

Restart kmod:


sudo /etc/init.d/kmod start

And you will get output that looks something like:

it really was that easy –

Adapter: SMBus I801 adapter at 3000
in0: +1.26 V (min = +0.00 V, max = +3.32 V)
Vcore: +1.14 V (min = +0.00 V, max = +2.99 V)
+3.3V: +3.33 V (min = +0.00 V, max = +4.38 V)
+5V: +5.10 V (min = +0.00 V, max = +6.64 V)
+12V: +12.06 V (min = +0.00 V, max = +15.94 V)
fan1: 2132 RPM (min = 0 RPM)
fan2: 0 RPM (min = 0 RPM)
fan3: 0 RPM (min = 0 RPM)
fan4: 657 RPM (min = 0 RPM)
temp1: +60.0°C (low = -127.0°C, high = +127.0°C)
M/B Temp: +41.0°C (low = -127.0°C, high = +127.0°C)
temp3: +48.0°C (low = -127.0°C, high = +127.0°C)
cpu0_vid: +0.000 V

Joe

for me I got:

sensors
acpitz-virtual-0
Adapter: Virtual device
temp1: +50.0°C (crit = +75.0°C)

k8temp-pci-00c3
Adapter: PCI adapter
Core0 Temp: +75.0°C
Core0 Temp: +72.0°C
Core1 Temp: +74.0°C
Core1 Temp: +73.0°C

(Yes I do have a dual core 64 bit AMD System)

Ahh as always. YMMV (your mileage may vary) applies!

Thanks Loni and Joe

Yup supposed to be 110F/43C here later this week!

Wayno

1

Getting x-windows to work over an ssh connection

by

This is something I do so frequently, I don’t even think twice about it.  Yet it does require some tweaking.  So here’s the magic behind getting x-windows to work over an ssh connection.

1.  Let’s make sure you have what we need to get started.  If not already installed, let’s install the openssh-server on both the SERVER and CLIENT machines.

sudo apt-get install openssh-server

2.  Now let’s backup the config files:  (as always the # (octothorpe) is a comment and that, or anything after that does NOT need to be coded!)

cd /etc/ssh  # change to the ssh configuration file directory

3.  First let’s make backup copies of the files:

sudo cp sshd_config sshd_config.org # back up the SERVER config file (WITH D)

sudo cp ssh_config ssh_config.org # copy over the CLIENT  config file (NO D)

4.  Using the editor of your choice, let’s change the files to allow x-11 forwarding.  First the SERVER file

Let’s change the coding!

gksudo gedit sshd_config # edit the SERVER config file (WITH D)

Find the line and make sure it reads:

X11Forwarding yes

There MAYBE an ‘#’ in front of the line, you may need to remove it!

Save the file!

6.  Now we’ll change the client side:


gksudo gedit ssh_config # edit the client side (NO D)

change the lines so they look like:

ForwardX11 yes
ForwardX11Trusted yes

You may need to remove the ‘#’ in front to uncomment.

Save it!

7.  Restart ssh


sudo service ssh restart

8.  Try it!

-X      Enables X11 forwarding.


ssh -X (hostname)

9.  Try to bring up gedit on the client side by simply typing:


gedit

If we did your homework right, gedit will come up on the client machine, running under ssh.  X rides for free.  This is great for remote execution of a programme.  Could be any X programme.

10. The programme will NOT show up on the other computer. However if you want to start something, but let the other person use it,


export DISPLAY=:0.0

You lose control though. (thanks for this tip, Loni)

2

How to do Certificate Based ssh Authentication

by

THANKS LONI!

How to do — Certificate Based Authentication

1. Go into .ssh directory

cd ~/.ssh

3. now do:

ssh-keygen

return on all of the prompts (i.e. take all the defaults)

It will look like this:

ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/bart/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/bart/.ssh/id_rsa.
Your public key has been saved in /home/bart/.ssh/id_rsa.pub.
The key fingerprint is:
12:34:56 and so on.
The key’s randomart image is:
+–[ RSA 2048]—-+

4. Enter the following to copy the certificate to the machine:

ssh-copy-id -i ~/.ssh/id_rsa.pub dohnuts

You will get output that looks like:

:~/.ssh$ ssh-copy-id -i ~/.ssh/id_rsa.pub simpsons
The authenticity of host ‘[simpsons.com]:12345 ([12.34.56.153]:12345)’ can’t be established.
RSA key fingerprint is ab:59:27:8a.

Are you sure you want to continue connecting (yes/no)? Yes
Warning: Permanently added ‘[simpsons.com]:12345,[12.34.56.153]:12345’ (RSA) to the list of known hosts.

Now try logging into the machine, with “ssh ‘dohnuts'”, and check in:

.ssh/authorized_keys

to make sure we haven’t added extra keys that you weren’t expecting.

5. Now login, using your password to complete.

6. in the future you would type:

ssh dohnuts

Look Ma, no password!