{"id":1808,"date":"2014-11-06T13:24:00","date_gmt":"2014-11-06T19:24:00","guid":{"rendered":"http:\/\/linuxitos.com\/main\/deshabilitar-sesiones-de-root-de-ssh-en-fedora\/"},"modified":"2014-11-06T13:24:00","modified_gmt":"2014-11-06T19:24:00","slug":"deshabilitar-sesiones-de-root-de-ssh-en-fedora","status":"publish","type":"post","link":"https:\/\/linuxitos.com\/main\/deshabilitar-sesiones-de-root-de-ssh-en-fedora\/","title":{"rendered":"Deshabilitar sesiones de root de ssh en fedora"},"content":{"rendered":"<div style=\"text-align: justify;\"><span style=\"font-family: Verdana,sans-serif;\">Los sistemas Linux vienen con el acceso de usuario root por defecto habilitado para realizar conexiones por ssh de forma remota. Por razones de seguridad, no es una buena idea tener ssh con acceso root permitido a usuarios no autorizados. Debido a que cualquier hacker puede tratar de hacer ataques de fuerza bruta de la contrase\u00f1a y acceder a su sistema.<\/p>\n<p><b><span style=\"color: blue;\">Deshabilitar SSH Root Login<\/span><\/b><\/p>\n<p>Es recomendable tener otra cuenta que usted usa con regularidad y cambie a usuario root mediante el uso de &#8216;su -&#8216; cuando sea necesario. Antes de empezar, aseg\u00farese de que tiene una cuenta de usuario normal y con eso su &#8211; o sudo para tener acceso de root.<\/p>\n<p>Utilizamos archivo de configuraci\u00f3n maestro sshd para deshabilitar el acceso del superusuario, as\u00ed puede disminuir y prevenir que un hacker tenga acceso root a tu m\u00e1quina Linux. Tambi\u00e9n veremos c\u00f3mo habilitar el acceso root de nuevo, as\u00ed como la manera de limitar el acceso ssh basado en la lista de usuarios.<br \/>Para deshabilitar el acceso del superusuario, abra el archivo principal de configuraci\u00f3n ssh, que est\u00e1 en <span style=\"color: purple;\">\/etc\/ssh\/sshd_config<\/span> con su editor favorito, gedit, nano, vi, vim.<\/span><\/p>\n<div>\n<div style=\"background-color: white; box-sizing: border-box; color: #444444; font-family: Roboto, Verdana, Helvetica, sans-serif; font-size: 15px; line-height: 22.5px; margin-bottom: 25px; margin-top: 25px; padding-left: 60px;\"><span style=\"box-sizing: border-box; font-weight: 700;\"><code style=\"background: url(http:\/\/blog.desdelinux.net\/wp-content\/themes\/DesdeLinuxV5_new\/img\/terminal.png) 50% 0% no-repeat scroll rgb(45, 45, 45); border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgb(0, 0, 0); box-sizing: border-box; color: #828fff; display: block; font-family: 'Roboto Mono', Consolas, monaco, monospace; font-size: 14px; font-weight: normal; margin: 8px 15px; padding: 30px 4px 10px; text-shadow: none; white-space: pre-wrap;\"># gedit \/etc\/ssh\/sshd_config<\/code><\/span><\/div>\n<\/div>\n<p><span style=\"font-family: Verdana,sans-serif;\">Busque la siguiente l\u00ednea en el archivo.<\/p>\n<p><span style=\"color: #783f04;\">      # PermitRootLogin no <\/span><\/p>\n<p>Retire el &#8216;#&#8217; en el principio de la l\u00ednea.<br \/>&nbsp;<\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"color: #783f04;\"><span style=\"font-family: Verdana,sans-serif;\">&nbsp;PermitRootLogin no<\/span><\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-family: Verdana,sans-serif;\"><br \/>A continuaci\u00f3n, tenemos que reiniciar el servicio del daemon SSH.<\/span><\/p>\n<div>\n<div style=\"background-color: white; box-sizing: border-box; color: #444444; font-family: Roboto, Verdana, Helvetica, sans-serif; font-size: 15px; line-height: 22.5px; margin-bottom: 25px; margin-top: 25px; padding-left: 60px;\"><span style=\"box-sizing: border-box; font-weight: 700;\"><code style=\"background: url(http:\/\/blog.desdelinux.net\/wp-content\/themes\/DesdeLinuxV5_new\/img\/terminal.png) 50% 0% no-repeat scroll rgb(45, 45, 45); border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgb(0, 0, 0); box-sizing: border-box; color: #828fff; display: block; font-family: 'Roboto Mono', Consolas, monaco, monospace; font-size: 14px; font-weight: normal; margin: 8px 15px; padding: 30px 4px 10px; text-shadow: none; white-space: pre-wrap;\"># \/etc\/init.d\/sshd restart<\/code><\/span><\/div>\n<\/div>\n<p><span style=\"font-family: Verdana,sans-serif;\">Ahora intenta iniciar sesi\u00f3n con el usuario root, obtendr\u00e1 \u00abAcceso denegado\u00bb error.<br \/><span style=\"color: #660000;\"><br \/>    login as: root<br \/>    Access denied<br \/>    root@172.31.41.51&#8217;s password:<\/span><\/p>\n<p>As\u00ed que, de ahora en adelante, si est\u00e1 registrado como usuario normal, deber\u00e1 acceder como tal y  luego usar el comando &#8216;su&#8217; para cambiar al usuario root.<\/p>\n<p><span style=\"color: #990000;\">      Iniciar sesi\u00f3n como: nameuser<br \/>     Acceso denegado<br \/>     nameuser@172.16.25.126 &#8216;s contrase\u00f1a:<br \/>     \u00daltimo acceso: Mar 16 Oct 2013 17:37:56 de 172.16.25.125<br \/>     [nameuser@machine ~] $ su &#8211;<br \/>     Contrase\u00f1a:<br \/>     [root @machine ~] # <\/span><\/p>\n<p><b><span style=\"color: blue;\">Habilitar SSH Root Login<\/span><\/b><br \/>Para habilitar el registro de ssh root, abra el archivo <span style=\"color: purple;\">\/etc\/ssh\/sshd_config<\/span><\/span><\/p>\n<div>\n<div style=\"background-color: white; box-sizing: border-box; color: #444444; font-family: Roboto, Verdana, Helvetica, sans-serif; font-size: 15px; line-height: 22.5px; margin-bottom: 25px; margin-top: 25px; padding-left: 60px;\"><span style=\"box-sizing: border-box; font-weight: 700;\"><code style=\"background: url(http:\/\/blog.desdelinux.net\/wp-content\/themes\/DesdeLinuxV5_new\/img\/terminal.png) 50% 0% no-repeat scroll rgb(45, 45, 45); border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgb(0, 0, 0); box-sizing: border-box; color: #828fff; display: block; font-family: 'Roboto Mono', Consolas, monaco, monospace; font-size: 14px; font-weight: normal; margin: 8px 15px; padding: 30px 4px 10px; text-shadow: none; white-space: pre-wrap;\"># gedit \/etc\/ssh\/sshd_config<\/code><\/span><\/div>\n<\/div>\n<p><span style=\"font-family: Verdana,sans-serif;\">Busque la siguiente l\u00ednea y ponega el \u00ab#\u00bb al principio y al guardar el archivo.<\/p>\n<p><span style=\"color: #783f04;\">      # PermitRootLogin no<\/span> <\/p>\n<p>Reinicie el servicio sshd.<\/span><\/p>\n<div>\n<div style=\"background-color: white; box-sizing: border-box; color: #444444; font-family: Roboto, Verdana, Helvetica, sans-serif; font-size: 15px; line-height: 22.5px; margin-bottom: 25px; margin-top: 25px; padding-left: 60px;\"><span style=\"box-sizing: border-box; font-weight: 700;\"><code style=\"background: url(http:\/\/blog.desdelinux.net\/wp-content\/themes\/DesdeLinuxV5_new\/img\/terminal.png) 50% 0% no-repeat scroll rgb(45, 45, 45); border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgb(0, 0, 0); box-sizing: border-box; color: #828fff; display: block; font-family: 'Roboto Mono', Consolas, monaco, monospace; font-size: 14px; font-weight: normal; margin: 8px 15px; padding: 30px 4px 10px; text-shadow: none; white-space: pre-wrap;\"># \/etc\/init.d\/sshd restart<\/code><\/span><\/div>\n<\/div>\n<p><span style=\"font-family: Verdana,sans-serif;\">Ahora le permitir\u00e1 iniciar sesi\u00f3n con el usuario root.<\/p>\n<p><span style=\"color: blue;\"><b>Limitar SSH conexiones del usuario<\/b><\/span><\/p>\n<p>Si usted tiene gran n\u00famero de cuentas de usuario en los sistemas, entonces tiene sentido que limitemos el acceso a distancia a aquellos usuarios que realmente lo necesitan. Abra el archivo \/etc\/ssh\/sshd_config file.<\/span><br \/><span style=\"font-family: Verdana,sans-serif;\"><span style=\"box-sizing: border-box; font-weight: 700;\"><code style=\"background: url(http:\/\/blog.desdelinux.net\/wp-content\/themes\/DesdeLinuxV5_new\/img\/terminal.png) 50% 0% no-repeat scroll rgb(45, 45, 45); border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgb(0, 0, 0); box-sizing: border-box; color: #828fff; display: block; font-family: 'Roboto Mono', Consolas, monaco, monospace; font-size: 14px; font-weight: normal; margin: 8px 15px; padding: 30px 4px 10px; text-shadow: none; white-space: pre-wrap;\"># gedit \/etc\/ssh\/sshd_config<\/code><\/span>A\u00f1adir una l\u00ednea AllowUsers en la parte inferior del archivo con un espacio separado por la lista de nombres de usuario. Por ejemplo, nameuser usuario y sheena ambos tienen acceso a la remota ssh.<\/p>\n<p><span style=\"color: #783f04;\">      AllowUsers nameuser sheena <\/span><\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-family: Verdana,sans-serif;\"><br \/><\/span><\/div>\n<div style=\"text-align: justify;\"><span style=\"font-family: Verdana,sans-serif;\">Y eso es todo para permitir conexiones de manera adecuada y evitar un ataque por ssh.<\/span><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Los sistemas Linux vienen con el acceso de usuario root por defecto habilitado para realizar conexiones por ssh de forma remota. Por razones de seguridad, no es una buena idea tener ssh con acceso root permitido a usuarios no autorizados. Debido a que cualquier hacker puede tratar de hacer ataques de fuerza bruta de la [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,1414,409,244],"tags":[],"class_list":["post-1808","post","type-post","status-publish","format-standard","hentry","category-fedora","category-login-ssh","category-root","category-ssh"],"_links":{"self":[{"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/posts\/1808","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/comments?post=1808"}],"version-history":[{"count":0,"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/posts\/1808\/revisions"}],"wp:attachment":[{"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/media?parent=1808"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/categories?post=1808"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxitos.com\/main\/wp-json\/wp\/v2\/tags?post=1808"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}