{"id":6542,"date":"2017-03-12T00:17:56","date_gmt":"2017-03-11T16:17:56","guid":{"rendered":"http:\/\/rmohan.com\/?p=6542"},"modified":"2017-03-12T00:17:56","modified_gmt":"2017-03-11T16:17:56","slug":"useradd-not-copying-any-file-from-skel-directory-into-it","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6542","title":{"rendered":"useradd  Not copying any file from skel directory into it."},"content":{"rendered":"<p>Useradd in Linux &#8211; Not copying any file from skel directory into it<br \/>\nuseradd: warning: the home directory already exists.<br \/>\nNot copying any file from skel directory into it.<\/p>\n<p>If the directory\u00a0 didn\u2019t exist , the Linux useradd process\u00a0 creates the directory and copies\u00a0 the skel files\u00a0 : .kshrc , .bashrc , .bash_profile and .bash_logout files into the user directory.<\/p>\n<p>As a DBA it is not unusual to receive a server with directories already in place. In those situations a scripted approach is required to copy the skel files. A quick and dirty solution is to add the following line after the useradd sequence<\/p>\n<p>cp -r \/etc\/skel\/. \/&lt;user_home_directpory&gt;<\/p>\n<p>An example sequence could be :<\/p>\n<p>groupadd skprod<\/p>\n<p>useradd -m -s \/bin\/bash -g skprod\u00a0 -d \/data\/app\/sit01\u00a0 sit01<br \/>\nchown -R sit01:skprod \/data\/app\/sit01<br \/>\ncp -r \/etc\/skel\/. \/data\/app\/-sit01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Useradd in Linux &#8211; Not copying any file from skel directory into it useradd: warning: the home directory already exists. Not copying any file from skel directory into it.<\/p>\n<p>If the directory didn\u2019t exist , the Linux useradd process creates the directory and copies the skel files : .kshrc , .bashrc , .bash_profile and .bash_logout [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,73],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6542"}],"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=6542"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6542\/revisions"}],"predecessor-version":[{"id":6543,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6542\/revisions\/6543"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6542"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6542"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6542"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}