{"id":358,"date":"2012-06-19T16:21:34","date_gmt":"2012-06-19T08:21:34","guid":{"rendered":"http:\/\/rmohan.com\/?p=358"},"modified":"2012-06-19T16:21:34","modified_gmt":"2012-06-19T08:21:34","slug":"sudo-on-linux","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=358","title":{"rendered":"SUDO on Linux"},"content":{"rendered":"<p>SUDO on Linux <\/p>\n<p>cat \/etc\/passwd<\/p>\n<p>test:x:500:500:test:\/home\/test:\/bin\/bash<\/p>\n<p>[root@localhost ~]# cp \/etc\/sudoers<br \/>\n[root@localhost ~]# cp \/etc\/sudoers \/etc\/sudoers.org<\/p>\n<p>1)  Full Permission to User<br \/>\n# User privilege specification<br \/>\ntest ALL=(ALL) ALL<\/p>\n<p>Let restart apache with out sudo <\/p>\n<p>[test@localhost ~]$ \/etc\/init.d\/httpd restart<br \/>\nrm: cannot remove `\/var\/run\/httpd\/httpd.pid&#8217;: Permission denied <\/p>\n<p>test@localhost ~]$ sudo \/etc\/init.d\/httpd restart<br \/>\n[sudo] password for test:<br \/>\nStopping httpd:                                            [  OK  ]<\/p>\n<p>sudo vi \/etc\/httpd\/conf\/httpd.conf<\/p>\n<p>2) Limited Permission to User<br \/>\n   Let restrict to apache stop,start restart <\/p>\n<p>test ALL=(ALL) \/etc\/init.d\/httpd <\/p>\n<p>3)Full permission to a user with No password <\/p>\n<p>  test ALL=(ALL) NOPASSWD:ALL<\/p>\n<p>[test@localhost ~]$ sudo \/etc\/init.d\/vsftpd restart<br \/>\nShutting down vsftpd:                                      [FAILED]<br \/>\nStarting vsftpd for vsftpd:                                [  OK  ]<\/p>\n<p>4) All Permission to Group<br \/>\n# Members of the admin group may gain root privileges<br \/>\n%admin ALL=(ALL) ALL<\/p>\n<p>5)  Limited Permission to Group<br \/>\n# Members of the admin group may gain root privileges<br \/>\n%admin ALL=(ALL) \/etc\/init.d\/ssh<\/p>\n<p>6)  All Permission to Group with No Password<br \/>\n# Members of the admin group may gain root privileges<br \/>\n%admin ALL=(ALL) NOPASSWD:ALL<\/p>\n<p>7)Give Limited Permission to Group with No Password<br \/>\n# Members of the admin group may gain root privileges<br \/>\n%admin ALL=(ALL) NOPASSWD:\/etc\/init.d\/ssh<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SUDO on Linux <\/p>\n<p>cat \/etc\/passwd<\/p>\n<p>test:x:500:500:test:\/home\/test:\/bin\/bash<\/p>\n<p>[root@localhost ~]# cp \/etc\/sudoers [root@localhost ~]# cp \/etc\/sudoers \/etc\/sudoers.org<\/p>\n<p>1) Full Permission to User # User privilege specification test ALL=(ALL) ALL<\/p>\n<p>Let restart apache with out sudo <\/p>\n<p>[test@localhost ~]$ \/etc\/init.d\/httpd restart rm: cannot remove `\/var\/run\/httpd\/httpd.pid&#8217;: Permission denied <\/p>\n<p>test@localhost ~]$ sudo \/etc\/init.d\/httpd restart [sudo] password for test: [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/358"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=358"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/358\/revisions"}],"predecessor-version":[{"id":359,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/358\/revisions\/359"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=358"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=358"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=358"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}