LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 01-07-2013, 09:12 PM   #1
FirstStepInLX
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, 12:20 AM   #2
EricTRA
Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 18 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290
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,

Eric

-------------
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 12:29 AM.
 
Old 01-08-2013, 03:36 AM   #3
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 1,612

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


Reply


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 12:20 AM
Add User Permission to Directory anjanesh Linux - Newbie 3 12-29-2007 10:28 AM
samba - add user script - User account does not exist itzamecwp Linux - Server 2 01-18-2007 10:52 PM
Linux - How to add a new user with the same root/super-user's privileges? asgarcymed Linux - General 8 12-23-2006 07:45 PM
Help! Cannot Add a User to User Manager or Change Root Password lennysokol Linux - General 2 06-25-2005 09:59 AM


All times are GMT -5. The time now is 11:45 PM.

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