Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 01-07-2013, 10:12 PM   #1
LQ Newbie
Registered: Jan 2013
Posts: 2

Rep: Reputation: Disabled
Add directory by the root to a new user (script)

I'm working on a script which create users automatically with some parameters. So i would like to ask how can i create repertories in the home directory of the new user

+ the script is used with sudo
# ./sudo name_script

My syntax is:

# after the creation of the new_user i tried this syntax:

mkdir new_directory

# when i check if the new_directory has been created
# i find it in the current user not in the new_user.

#I also tried this syntax,but the new_directory doesn't exist too.
#I supposed that now i'm in the new_user

su -l new_user

mkdir new_directory

#The creation of users woks good.
Old 01-08-2013, 01:20 AM   #2
LQ Guru
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Hello and welcome to LinuxQuestions,

Please don't post your question in multiple forums. Stick to one thread per problem to keep focus on it. I'm reporting this one for closure since it's a duplicate of this one.

Kind regards,


Disregard, mods closed your other thread while I was posting in it, so I'll stick to this one.

Last edited by EricTRA; 01-08-2013 at 01:29 AM.
Old 01-08-2013, 04:36 AM   #3
Senior Member
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 3,301

Rep: Reputation: 1006Reputation: 1006Reputation: 1006Reputation: 1006Reputation: 1006Reputation: 1006Reputation: 1006Reputation: 1006
1. google for /etc/skeleton
2. use this:
su -c 'mkdir ~/dir' newuser


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Add directory by the root to a new user (script) FirstStepInLX Ubuntu 1 01-08-2013 01:20 AM
Add User Permission to Directory anjanesh Linux - Newbie 3 12-29-2007 11:28 AM
samba - add user script - User account does not exist itzamecwp Linux - Server 2 01-18-2007 11:52 PM
Linux - How to add a new user with the same root/super-user's privileges? asgarcymed Linux - General 8 12-23-2006 08:45 PM
Help! Cannot Add a User to User Manager or Change Root Password lennysokol Linux - General 2 06-25-2005 10:59 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:30 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration