Thursday, 9 June 2016

Enable SSH root login on Debian Linux Server

After fresh system installation the root login on the Debian Linux is disabled by default. When you attempt to login as root user to your Debian Jessie Linux server the access will be denied eg.:
$ ssh root@10.1.1.12
root@10.1.1.12's password: 
Permission denied, please try again.
root@10.1.1.12's password: 
Permission denied, please try again.
root@10.1.1.12's password: 
Permission denied (publickey,password).
To enable SSH login for a root user on Debian Linux system you need to first configure SSH server. Open /etc/ssh/sshd_config and change the following line:
FROM:
PermitRootLogin without-password
TO:
PermitRootLogin yes
Once you made the above change restart your SSH server:
# /etc/init.d/ssh restart
[ ok ] Restarting ssh (via systemctl): ssh.service.
From now on you will be able to ssh login as a root:
$ ssh root@10.1.1.12
root@10.1.1.12's password: 

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
The following guide will provide you with the information on how to enable SSH root login on Ubuntu 16.04 Xenial Xerus Linux Server/Desktop.

The following config will guide you through the process of enabling SSH root login on Ubuntu 16.04 Xenial Xerus Linux Server or Desktop. This guide assumes that you are in possession of root password and are able to login directly on your system as root user. Use the following guide, if you do not have a root's user password.

By default the root's ssh remote shell access is denied by default. Any attempt to remote login as root will result in Permission deniedmessage:
$ ssh root@10.0.0.55
root@10.0.0.55's password: 
Permission denied, please try again.
root@10.0.0.55's password:
In order to enable root ssh login on Ubuntu 16.04 Xenial Xerus Linux run the following command:
$ sudo sed -i 's/prohibit-password/yes/' /etc/ssh/sshd_config
or manually open sshd configuration file /etc/ssh/sshd_config and change line:
FROM:
PermitRootLogin prohibit-password
TO:
PermitRootLogin yes
Once you have made the above configuration change restart ssh daemon:
$ sudo systemctl restart sshd
After you restart sshd daemon you will be able to remotely login as a root user:
$ ssh root@10.0.0.55
root@10.0.0.55's password: 
Welcome to Ubuntu 16.04 LTS (GNU/Linux 4.4.0-22-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

22 packages can be updated.
20 updates are security updates.


The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

Howto mount USB drive in Linux

1. Example

2. Detecting USB hard drive

After you plug in your USB device to your USB port, linux will add new block device into /dev/ directory. At this stage you are not able to use this device as the USB filesystem needs to be mouted before you are able to retrieve any data. To find out what name your block device file have you can run fdisk command:
# fdisk -l 
You will get output similar to this:
Disk /dev/sdb: 60.0 GB, 60060155904 bytes
255 heads, 63 sectors/track, 7301 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000b2b03

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        7301    58645251    b  W95 FAT32

3. Creating mount point

Create directory where you want to mount your device:
mkdir /mnt/sdb1 

4. Edit /etc/fstab

To automate this process you can edit /etc/fstab file and add line similar to this:
/dev/sdb1       /mnt/sdb1           vfat    defaults        0       0 
Run mount command to mount all not yet mounted devices. Keep in mind that if you have more different USB devices in you system, device name can vary!!!
# mount -a