{"id":75,"date":"2015-01-22T10:34:59","date_gmt":"2015-01-22T10:34:59","guid":{"rendered":"https:\/\/edulab.unitn.it\/tecnici\/?p=75"},"modified":"2018-03-01T14:08:57","modified_gmt":"2018-03-01T14:08:57","slug":"linux-debian-base-ssh","status":"publish","type":"post","link":"https:\/\/edulab.unitn.it\/tecnici\/linux-debian-base-ssh\/","title":{"rendered":"Linux Debian Base ssh"},"content":{"rendered":"<div class=\"page\">\n<div class=\"level1\">\n<h3>Chiavi SSH<\/h3>\n<p>Supponiamo (a scopo dimostrativo) che il server remoto si trovi all&#8217;indirizzo IP 192.168.0.2 e supponiamo inoltre di avere un account chiamato user sulla macchina remota.<\/p>\n<p>Per prima cosa dobbiamo generare la coppia di chiavi sulla nostra macchina locale (n.b: non utilizzo alcuna passphrase, altrimenti mi verrebbe richiesta comunque al primo login di ogni sessione):<\/p>\n<pre class=\"code\">user:~$ ssh-keygen -t rsa\r\nGenerating public\/private dsa key pair.\r\nEnter file in which to save the key (\/home\/user\/.ssh\/id_rsa):\r\nEnter passphrase (empty for no passphrase):\r\nEnter same passphrase again:\r\nYour identification has been saved in \/home\/user\/.ssh\/id_rsa.\r\nYour public key has been saved in \/home\/user\/.ssh\/id_rsa.pub.\r\nThe key fingerprint is:\r\nA questo punto dobbiamo copiare la chiave pubblica appena generata, sul server remoto:<\/pre>\n<pre class=\"code\">cd ~\/.ssh\/\r\nscp id_rsa.pub user@192.168.0.2:.\/id_rsa.pub<\/pre>\n<p>Ci verr\u00e0 chiesta la nostra password remota, per poter effettuare la copia del file. A questo punto dobbiamo connetterci via <acronym title=\"Secure Shell\">SSH<\/acronym> al server remoto:<\/p>\n<pre class=\"code\">ssh user@192.168.0.2<\/pre>\n<p>Quando abbiamo effettuato correttamente il login, dobbiamo procedere con i seguenti comandi:<\/p>\n<pre class=\"code\">cd .ssh\r\ntouch authorized_keys\r\nchmod 600 authorized_keys\r\ncat ..\/id_rsa.pub &gt;&gt; authorized_keys\r\nrm ..\/id_rsa.pub<\/pre>\n<p>Il gioco \u00e8 fatto! Le successive connessioni <acronym title=\"Secure Shell\">SSH<\/acronym> che effettueremo verso il server remoto, avverranno senza la richiesta di alcuna password.<\/p>\n<\/div>\n<h5 class=\"sectionedit2\">Esempio di comando da remoto<\/h5>\n<div class=\"level3\">\n<pre class=\"code\">ssh [utente]@[IP\/Nome] \" [comando\"]<\/pre>\n<\/div>\n<\/div>\n<div class=\"clearer\"><\/div>\n<h2>Enable SSH root login on Debian Linux Server<\/h2>\n<p><a href=\"http:\/\/linuxconfig.org\/enable-ssh-root-login-on-debian-linux-server\">Fonte<\/a><\/p>\n<div class=\"item-page\">\n<div class=\"jsn-article-toolbar\"><\/div>\n<p>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.:<\/p>\n<pre>$ ssh <span id=\"cloak35022\"><a href=\"mailto:root@10.1.1.12\">root@10.1.1.12<\/a><\/span>\r\n<span id=\"cloak22190\"><a href=\"mailto:root@10.1.1.12\">root@10.1.1.12<\/a><\/span>'s password: \r\nPermission denied, please try again.\r\n<span id=\"cloak89295\"><a href=\"mailto:root@10.1.1.12\">root@10.1.1.12<\/a><\/span>'s password: \r\nPermission denied, please try again.\r\n<span id=\"cloak75910\"><a href=\"mailto:root@10.1.1.12\">root@10.1.1.12<\/a><\/span>'s password: \r\nPermission denied (publickey,password).\r\n<\/pre>\n<p>To enable SSH login for a root user on Debian Linux system you need to first configure SSH server. Open <code>\/etc\/ssh\/sshd_config<\/code> and change the following line:<\/p>\n<pre>FROM:\r\nPermitRootLogin without-password\r\nTO:\r\nPermitRootLogin yes\r\n<\/pre>\n<p>Once you made the above change restart your SSH server:<\/p>\n<pre># \/etc\/init.d\/ssh restart\r\n[ ok ] Restarting ssh (via systemctl): ssh.service.\r\n<\/pre>\n<p>From now on you will be able to ssh login as a root:<\/p>\n<pre>$ ssh <span id=\"cloak32579\"><a href=\"mailto:root@10.1.1.12\">root@10.1.1.12<\/a><\/span>\r\n<span id=\"cloak38776\"><a href=\"mailto:root@10.1.1.12\">root@10.1.1.12<\/a><\/span>'s password: \r\n\r\nThe programs included with the Debian GNU\/Linux system are free software;\r\nthe exact distribution terms for each program are described in the\r\nindividual files in \/usr\/share\/doc\/*\/copyright.\r\n\r\nDebian GNU\/Linux comes with ABSOLUTELY NO WARRANTY, to the extent\r\npermitted by applicable law.\r\n<\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Chiavi SSH Supponiamo (a scopo dimostrativo) che il server remoto si trovi all&#8217;indirizzo IP 192.168.0.2 e supponiamo inoltre di avere un account chiamato user sulla macchina remota. Per prima cosa [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,9],"tags":[],"class_list":["post-75","post","type-post","status-publish","format-standard","hentry","category-how-to","category-linux"],"_links":{"self":[{"href":"https:\/\/edulab.unitn.it\/tecnici\/wp-json\/wp\/v2\/posts\/75","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/edulab.unitn.it\/tecnici\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/edulab.unitn.it\/tecnici\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/edulab.unitn.it\/tecnici\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/edulab.unitn.it\/tecnici\/wp-json\/wp\/v2\/comments?post=75"}],"version-history":[{"count":10,"href":"https:\/\/edulab.unitn.it\/tecnici\/wp-json\/wp\/v2\/posts\/75\/revisions"}],"predecessor-version":[{"id":736,"href":"https:\/\/edulab.unitn.it\/tecnici\/wp-json\/wp\/v2\/posts\/75\/revisions\/736"}],"wp:attachment":[{"href":"https:\/\/edulab.unitn.it\/tecnici\/wp-json\/wp\/v2\/media?parent=75"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/edulab.unitn.it\/tecnici\/wp-json\/wp\/v2\/categories?post=75"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/edulab.unitn.it\/tecnici\/wp-json\/wp\/v2\/tags?post=75"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}