User Tools

Site Tools


computing:environments:gnulinux:home

GNU/Linux

This page concerns the Debian distribution (Jessie, then Stretch), but may also be applied to other GNU/Linux (or POSIX) distributions.

Connection through 'ssh' without password

To enable the connection to a host without password, launch from the machine from where you want to connect : ssh-copy-id [<login>@]<host>.

Numlock enabled by default

When installing Debian Jessie in a virtual machine, the numlock is disabled by default. To enable it by default, you should do the following :

  • Install the numlockx package,
  • add /usr/bin/numlockx on & to the end of file /etc/X11/xinit/xinitrc.

Compiling for IA-32 under an AMD64 environment

When compiling for IA-32 under a AMD64 enviroment (by passing the -m32 option to both compiler and linker), the compiler will complain about missing headers. To fix this, install g++-multilib package.

Fetching informations

OS

  • uname -a,
  • lsb_release -a (package lsb-release, with -, not _),
  • cat
    • /proc/version,
    • /etc/issue,
    • /etc/issue.net,
    • /etc/*release,
    • /etc/*version.

Hardware

http://www.binarytides.com/linux-commands-hardware-info/

  • lscpu,
  • lshw -short,
  • hwinfo --short,
  • df -h,
  • free,
  • cat /proc/
    • cpuinfo,
    • meminfo,

Miscellaneous

  • Temperature : with package lm-sensors sensors,
  • frequencies : with package cpufrequtils cpufreq-info.

'sudo'

Setting

To give a user same rights as for root through sudo, add a file in /etc/sudoers.d/ with following content :

<user> ALL=(ALL) ALL

where <user> is the user's login.

visudo should be used to edit this file, but it's not needed. The content of the created file is immediately take in account by sudo.

Error 'unable to resolve <hostname>'

To avoid this error when sudoing, following conditions must be met (from http://askubuntu.com/questions/59458/error-message-when-i-run-sudo-unable-to-resolve-host-none) :

  • /etc/hostname must contain <hostname> (hostname <hostname> command works only until next reboot),
  • there must be an entry in /etc/hosts/ where <hostname> points to 127.0.0.1.
Depending on your configuration, the modification in /etc/hosts will not survive to a reboot. You should then have a comment at the head of your /etc/hosts file, which indicates that you have to modify a file in /etc/cloud/templates, but the given file may not be the correct one. Under Debian, for example, you have to modify hosts.debian.tmpl file, not hosts.tmpl.

USB

What follows may only concern ARM architectures ; it was not tested on x86 architectures.

:!: It seems that you have to install the ntfs-3g package before installing the usbmount package, or the NTFS devices will only be read-only.

  • To automount USB devices, install usbmount package,
  • In order to mount NTFS devices, add ntfs fuseblk to FILESYSTEMS in /etc/usbmount/usbmount.conf

The devices will be accessible under /media/usb….

The fdisk -l command will show if your USB device is recognized (recognized does not means mounted).

:!: Trouble with NTFS devices auto-mounting : https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=774149.

Clock

  • To set the correct time from a server (package ntpdate) : ntpdate <server>, with <server>, a NTP server (ntp.ubuntu.com for example),
  • to display the hardware clock : hwclock,
  • to synchronize the hardware clock with system clock : hwclock –systohc,
  • to synchronize the system clock with hardware clock : hwclock –hctosys.

WiFi

  • Install wpasupplicant package,
  • Launch wpa-passphrass <SSID> <key>, where <SSID> is the SSID of the WiFi network, and <key>, the corresponding key. You should obtain something like :
network={
        ssid="<SSID>"
        #psk="<key>"
        psk=3a19d8ecd12eff56bbebd67af8e4c14e1b4b5fb1a278f7e5c474ad252853a1d9
}
  • in /etc/network/interfaces, insert :
auto wlan0
iface wlan0 inet dhcp
    wpa-ssid <SSID>
    wpa-scan-ssid 1 # If the SSID id hidden.
    wpa-psk <psk>

where <SSID> is the SSID of the WiFi network, and <psk> the hexadecimal string right of the uncommented above psk= entry.

  • launch ifup wlan0.

Hostname

To change hostname :

  • Until next reboot : hostname <name> (you must logout to see the change),
  • permanently : modify file /etc/hostname.
If the hostname doesn't match an ID of the SSL certificate, apache will complain.

How to correctly set the hostname to avoid some error messages (for example unable to resolve host … with sudo): https://askubuntu.com/questions/59458/

Configuring an account to allow backup only

You may want to backup the entire www-data account (which contains the web pages) using scp or rsync, but you get a message like protocol version mismatch – is your shell clean?. This is because the the shell for this account is a restricted one (probably /usr/sbin/nologin, as you will see in /etc/passwd).

To fix this :

  • install rssh package,
  • modify /etc/passwd so the shell will be /usr/bin/rssh (bin, not sbin) for the desired account,
  • modify /etc/rssh.conf accordingly.

Other

computing/environments/gnulinux/home.txt · Last modified: Tue Aug 1 08:22:37 2017 (01/08/17) by Claude SIMON