{"id":23025,"date":"2015-07-15T21:44:53","date_gmt":"2015-07-15T16:14:53","guid":{"rendered":"https:\/\/2thenew.today\/blog\/?p=23025"},"modified":"2015-10-01T15:26:56","modified_gmt":"2015-10-01T09:56:56","slug":"resctricted-remote-sftp-user-access","status":"publish","type":"post","link":"https:\/\/2thenew.today\/blog\/resctricted-remote-sftp-user-access\/","title":{"rendered":"Setting up restricted remote SFTP server"},"content":{"rendered":"<p>This blog post refers to a use case I came across recently wherein, a few users had to remotely <a href=\"https:\/\/2thenew.today\/blog\/blocking-ip-addresses-with-false-intentions-using-fail2ban\/\">log into the server using SFTP<\/a>. These users should be restricted to perform read\/write operation only in their home directory and only from office network i.e the public IP address(es), their office network is fabricated upon. To achieve this, we have to create SFTP users on Linux machine and those users should have only read\/write privileges only in their home directory and access should be allowed only from a particular public IP (lets say public IP of their office network). This blog assumes SSH service is already running on the Linux machine and below commands has been tested on ubuntu 14.04<\/p>\n<p>Steps to create restricted SFTP users,<\/p>\n<p>1) Create a user group<\/p>\n<p>[js]groupadd sftp[\/js]<\/p>\n<p>2) Create users in above group and set the password,<\/p>\n<p>[js]useradd -m user1 -g sftp[\/js]<\/p>\n<p>&nbsp;<\/p>\n<p>[js]passwd user1[\/js]<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-23027\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/07\/Selection_073.png\" alt=\"Selection_073\" width=\"644\" height=\"180\" \/><\/p>\n<p>3) Edit \/etc\/sshd\/sshd_config<\/p>\n<p>3.a) Enable password authentication so that users can login using their respective passwords.<\/p>\n<p>[js]PasswordAuthentication yes[\/js]<\/p>\n<p>3.b) Only users included in sftp group should be able to perform sftp login<\/p>\n<p>[js]Match Group sftp[\/js]<\/p>\n<p>3.c) Mention users along with their network&#8217;s public\/real IP addresses (Public\/real IP address can be obtained by running command #curl ifconfig.me<\/p>\n<p>[js]AllowUsers user1@&lt;public ipaddress1&gt; user2@&lt;public ipaddress1&gt; user2@&lt;public ip address2&gt;[\/js]<\/p>\n<p>3.d) Restart the ssh service<\/p>\n<p>[js]service ssh restart[\/js]<\/p>\n<p>4) After successfully completing above step, check if the implementation has taken place successfully by trying to sftp login with the above created user. To log into server, you must have IP address of the server,<\/p>\n<p>[js]sftp user1@&lt;server public ipaddress&gt;[\/js]<\/p>\n<p>If above user login command executed successfully, it will login intelligrape with sftp shell prompt.<\/p>\n<p>Regards<br \/>\nSharad Aggarwal<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This blog post refers to a use case I came across recently wherein, a few users had to remotely log into the server using SFTP. These users should be restricted to perform read\/write operation only in their home directory and only from office network i.e the public IP address(es), their office network is fabricated upon. [&hellip;]<\/p>\n","protected":false},"author":176,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":6,"footnotes":""},"categories":[1174,1],"tags":[521,1152,553],"class_list":["post-23025","post","type-post","status-publish","format-standard","hentry","category-aws-2","category-technology","tag-custom-security","tag-sftp","tag-ssh"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"This blog post refers to a use case I came across recently wherein, a few users had to remotely log into the server using SFTP. These users should be restricted to perform read\/write operation only in their home directory and only from office network i.e the public IP address(es), their office network is fabricated upon.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Sharad Aggarwal\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/2thenew.today\/blog\/resctricted-remote-sftp-user-access\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"TO THE NEW BLOG\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Setting up restricted remote SFTP server | TO THE NEW Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"This blog post refers to a use case I came across recently wherein, a few users had to remotely log into the server using SFTP. These users should be restricted to perform read\/write operation only in their home directory and only from office network i.e the public IP address(es), their office network is fabricated upon.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/2thenew.today\/blog\/resctricted-remote-sftp-user-access\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/2thenew.today\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/2thenew.today\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta property=\"article:tag\" content=\"aws\" \/>\n\t\t<meta property=\"article:tag\" content=\"technology\" \/>\n\t\t<meta property=\"article:tag\" content=\"custom security\" \/>\n\t\t<meta property=\"article:tag\" content=\"sftp\" \/>\n\t\t<meta property=\"article:tag\" content=\"ssh\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2015-07-15T16:14:53+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2015-10-01T09:56:56+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@tothenew\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Setting up restricted remote SFTP server | TO THE NEW Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"This blog post refers to a use case I came across recently wherein, a few users had to remotely log into the server using SFTP. These users should be restricted to perform read\/write operation only in their home directory and only from office network i.e the public IP address(es), their office network is fabricated upon.\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/2thenew.today\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/resctricted-remote-sftp-user-access\\\/#article\",\"name\":\"Setting up restricted remote SFTP server | TO THE NEW Blog\",\"headline\":\"Setting up restricted remote SFTP server\",\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/sharadaintelligrape-com\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"\\\/blog\\\/wp-ttn-blog\\\/uploads\\\/2015\\\/07\\\/Selection_073.png\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/resctricted-remote-sftp-user-access\\\/#articleImage\"},\"datePublished\":\"2015-07-15T21:44:53+05:30\",\"dateModified\":\"2015-10-01T15:26:56+05:30\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/resctricted-remote-sftp-user-access\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/resctricted-remote-sftp-user-access\\\/#webpage\"},\"articleSection\":\"AWS, Technology, Custom Security, sftp, ssh\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/resctricted-remote-sftp-user-access\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"position\":2,\"name\":\"Technology\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/resctricted-remote-sftp-user-access\\\/#listItem\",\"name\":\"Setting up restricted remote SFTP server\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/resctricted-remote-sftp-user-access\\\/#listItem\",\"position\":3,\"name\":\"Setting up restricted remote SFTP server\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\",\"name\":\"TO THE NEW Blog\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/sharadaintelligrape-com\\\/#author\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/sharadaintelligrape-com\\\/\",\"name\":\"Sharad Aggarwal\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/resctricted-remote-sftp-user-access\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/26dfa662d5c2e5fb85587a4a8d9404253ddfa759bd479bb04336d9e1f7d25427?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Sharad Aggarwal\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/resctricted-remote-sftp-user-access\\\/#webpage\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/resctricted-remote-sftp-user-access\\\/\",\"name\":\"Setting up restricted remote SFTP server | TO THE NEW Blog\",\"description\":\"This blog post refers to a use case I came across recently wherein, a few users had to remotely log into the server using SFTP. These users should be restricted to perform read\\\/write operation only in their home directory and only from office network i.e the public IP address(es), their office network is fabricated upon.\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/resctricted-remote-sftp-user-access\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/sharadaintelligrape-com\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/sharadaintelligrape-com\\\/#author\"},\"datePublished\":\"2015-07-15T21:44:53+05:30\",\"dateModified\":\"2015-10-01T15:26:56+05:30\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\",\"name\":\"TO THE NEW Blog\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Setting up restricted remote SFTP server | TO THE NEW Blog","description":"This blog post refers to a use case I came across recently wherein, a few users had to remotely log into the server using SFTP. These users should be restricted to perform read\/write operation only in their home directory and only from office network i.e the public IP address(es), their office network is fabricated upon.","canonical_url":"https:\/\/2thenew.today\/blog\/resctricted-remote-sftp-user-access\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/2thenew.today\/blog\/resctricted-remote-sftp-user-access\/#article","name":"Setting up restricted remote SFTP server | TO THE NEW Blog","headline":"Setting up restricted remote SFTP server","author":{"@id":"https:\/\/2thenew.today\/blog\/author\/sharadaintelligrape-com\/#author"},"publisher":{"@id":"https:\/\/2thenew.today\/blog\/#organization"},"image":{"@type":"ImageObject","url":"\/blog\/wp-ttn-blog\/uploads\/2015\/07\/Selection_073.png","@id":"https:\/\/2thenew.today\/blog\/resctricted-remote-sftp-user-access\/#articleImage"},"datePublished":"2015-07-15T21:44:53+05:30","dateModified":"2015-10-01T15:26:56+05:30","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/2thenew.today\/blog\/resctricted-remote-sftp-user-access\/#webpage"},"isPartOf":{"@id":"https:\/\/2thenew.today\/blog\/resctricted-remote-sftp-user-access\/#webpage"},"articleSection":"AWS, Technology, Custom Security, sftp, ssh"},{"@type":"BreadcrumbList","@id":"https:\/\/2thenew.today\/blog\/resctricted-remote-sftp-user-access\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog#listItem","position":1,"name":"Home","item":"https:\/\/2thenew.today\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog\/category\/technology\/#listItem","name":"Technology"}},{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog\/category\/technology\/#listItem","position":2,"name":"Technology","item":"https:\/\/2thenew.today\/blog\/category\/technology\/","nextItem":{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog\/resctricted-remote-sftp-user-access\/#listItem","name":"Setting up restricted remote SFTP server"},"previousItem":{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog\/resctricted-remote-sftp-user-access\/#listItem","position":3,"name":"Setting up restricted remote SFTP server","previousItem":{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog\/category\/technology\/#listItem","name":"Technology"}}]},{"@type":"Organization","@id":"https:\/\/2thenew.today\/blog\/#organization","name":"TO THE NEW Blog","url":"https:\/\/2thenew.today\/blog\/"},{"@type":"Person","@id":"https:\/\/2thenew.today\/blog\/author\/sharadaintelligrape-com\/#author","url":"https:\/\/2thenew.today\/blog\/author\/sharadaintelligrape-com\/","name":"Sharad Aggarwal","image":{"@type":"ImageObject","@id":"https:\/\/2thenew.today\/blog\/resctricted-remote-sftp-user-access\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/26dfa662d5c2e5fb85587a4a8d9404253ddfa759bd479bb04336d9e1f7d25427?s=96&d=mm&r=g","width":96,"height":96,"caption":"Sharad Aggarwal"}},{"@type":"WebPage","@id":"https:\/\/2thenew.today\/blog\/resctricted-remote-sftp-user-access\/#webpage","url":"https:\/\/2thenew.today\/blog\/resctricted-remote-sftp-user-access\/","name":"Setting up restricted remote SFTP server | TO THE NEW Blog","description":"This blog post refers to a use case I came across recently wherein, a few users had to remotely log into the server using SFTP. These users should be restricted to perform read\/write operation only in their home directory and only from office network i.e the public IP address(es), their office network is fabricated upon.","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/2thenew.today\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/2thenew.today\/blog\/resctricted-remote-sftp-user-access\/#breadcrumblist"},"author":{"@id":"https:\/\/2thenew.today\/blog\/author\/sharadaintelligrape-com\/#author"},"creator":{"@id":"https:\/\/2thenew.today\/blog\/author\/sharadaintelligrape-com\/#author"},"datePublished":"2015-07-15T21:44:53+05:30","dateModified":"2015-10-01T15:26:56+05:30"},{"@type":"WebSite","@id":"https:\/\/2thenew.today\/blog\/#website","url":"https:\/\/2thenew.today\/blog\/","name":"TO THE NEW Blog","inLanguage":"en-US","publisher":{"@id":"https:\/\/2thenew.today\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"TO THE NEW BLOG","og:type":"article","og:title":"Setting up restricted remote SFTP server | TO THE NEW Blog","og:description":"This blog post refers to a use case I came across recently wherein, a few users had to remotely log into the server using SFTP. These users should be restricted to perform read\/write operation only in their home directory and only from office network i.e the public IP address(es), their office network is fabricated upon.","og:url":"https:\/\/2thenew.today\/blog\/resctricted-remote-sftp-user-access\/","og:image":"https:\/\/2thenew.today\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","og:image:secure_url":"https:\/\/2thenew.today\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","article:tag":["aws","technology","custom security","sftp","ssh"],"article:published_time":"2015-07-15T16:14:53+00:00","article:modified_time":"2015-10-01T09:56:56+00:00","twitter:card":"summary","twitter:site":"@tothenew","twitter:title":"Setting up restricted remote SFTP server | TO THE NEW Blog","twitter:description":"This blog post refers to a use case I came across recently wherein, a few users had to remotely log into the server using SFTP. These users should be restricted to perform read\/write operation only in their home directory and only from office network i.e the public IP address(es), their office network is fabricated upon.","twitter:image":"https:\/\/2thenew.today\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png"},"aioseo_meta_data":{"post_id":"23025","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":"","og_description":"","og_object_type":"article","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":"","og_article_tags":"","twitter_use_og":false,"twitter_card":"summary","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"created":"2021-04-29 14:52:29","updated":"2024-02-29 09:25:24","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/2thenew.today\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/2thenew.today\/blog\/category\/technology\/\" title=\"Technology\">Technology<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tSetting up restricted remote SFTP server\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/2thenew.today\/blog"},{"label":"Technology","link":"https:\/\/2thenew.today\/blog\/category\/technology\/"},{"label":"Setting up restricted remote SFTP server","link":"https:\/\/2thenew.today\/blog\/resctricted-remote-sftp-user-access\/"}],"_links":{"self":[{"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/posts\/23025","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/users\/176"}],"replies":[{"embeddable":true,"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/comments?post=23025"}],"version-history":[{"count":0,"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/posts\/23025\/revisions"}],"wp:attachment":[{"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/media?parent=23025"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/categories?post=23025"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/tags?post=23025"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}