Advertisement

09.14.2007 at 11:12PM PDT, ID: 22830615
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

script to create user directory

Tags: create, directory, user, script
Hi All ,
I would like to write script to do the following :

mkdir /home
chmod -R 755 /home
mkdir /home/"username"
chmod -R 700 /home/"username"
chown -R "username" :"Group" /home/"username"

as listed you can see i have two variables "username","group"
take in consideration that i have list of username and its' group
the user's home folder need to be created in one machine
and i have 11 users..so i need to eleminate typing this command 11 times

in matter of fact i don't have background to write scripts for apple .and how to make the script from my users list
Start your free trial to view this solution
Question Stats
Zone: Apple
Question Asked By: yasalem
Solution Provided By: Computer101
Participating Experts: 3
Solution Grade: A
Views: 29
Translate:
Loading Advertisement...
09.15.2007 at 02:12AM PDT, ID: 19897012

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
09.15.2007 at 05:28AM PDT, ID: 19897312

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
09.15.2007 at 07:22PM PDT, ID: 19899290

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
09.15.2007 at 09:27PM PDT, ID: 19899535

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
09.16.2007 at 12:20AM PDT, ID: 19899804

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
09.16.2007 at 06:17PM PDT, ID: 19902398

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
09.16.2007 at 07:19PM PDT, ID: 19902556

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
09.19.2007 at 04:15PM PDT, ID: 19925164

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
10.17.2007 at 07:23AM PDT, ID: 20093624

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
10.21.2007 at 08:04PM PDT, ID: 20120548

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
09.15.2007 at 02:12AM PDT, ID: 19897012
one easy way is to use a spreadsheet application. this isn't very elegant, but it works, is easy, and you can do it yourself next time.
For the bits that have variables:
column 1 - username (have different one in each row)
column 2 - group (have different one in each row)
column 3 - mkdir /home/ (fill this and next few down and make this the same for as many rows as you are using)
column 4 - chmod -R 700 /home/
column 5 - chown -R
column 6 - :
column 7 - /home/
column 8 - column3&column1 (this creates the command: mkdir /home/"username")
column 9 - column4&column1 (this creates the command: chmod -R 700 /home/"username")
column 10 - column4&" "&column1&column6&column2&column7&column1  (this creates the command: chown -R "username" :"Group" /home/"username")

Then copy the commands, paste into a text editor, save as a text file and run a s a script.
That's how I'd do it anyway...

Good luck!
 
09.15.2007 at 05:28AM PDT, ID: 19897312
Thanks ,it could be solve my problem....but I am looking for a professional solution
 
09.15.2007 at 07:22PM PDT, ID: 19899290
righto, good luck, I'm sure you'll get an answer soon enough...
 
09.15.2007 at 09:27PM PDT, ID: 19899535
hey wil78u200 ,
i didn't mean to be rude,..i really appreciate your help...
Thanks
 
09.16.2007 at 12:20AM PDT, ID: 19899804
that's ok mate.
I'd help more, but i'm not really an expert on shell scripting.
I will have a loop that uses scanf(%s, buffer) to rad the username and group names from a file I guess, but I'd have to go and read a book to learn to right it, so Iguess you can do that just as quickly as I can!
Else someone who is good in the area will speak up..
Good luck
 
09.16.2007 at 06:17PM PDT, ID: 19902398
well do you want a script that all you have to do is change the user name and group or would you like something that would run and grab the user and group from a text file or what?

the falllowing you can just past into term and it will do it for you

(run this part once)

mkdir /home
chmod -R 755 /home

(from here on just replace crashelite and admin to what ever user name and group you want)

Username=crashelite
Group=admin
mkdir /home/$Username
chmod -R 700 /home/$Username
chown -R $username:$Group /home/$Username



i know there is a way to pull the variables from a file but i only know mild about shell scripting let me know if you want more information cause i can look into the pulling variables from files and ya
 
09.16.2007 at 07:19PM PDT, ID: 19902556
well i take that back i did get it to work with the fallowing

create a file names User.data
put in the users and groups as so
Me admin
Bob user


then copy fallowing into file name ug.sh
"
#!/bin/sh

mkdir /home
chmod -R 755 /home

cat User.data |   \
while read User Group
do
      echo "Found User: $User"
      echo "Found Group: $Group"
      mkdir /home/$User
      chmod -R 700 /home/$User
      chown -R $User:$Group /home/$User
done

"
now this script works partly i will not do the chown portion for some reason  

oh ya and to run it just save to the main users folder then run it by typing ug.sh

but here is the problem

CRASH-2:~ crash$ sh ug.sh
Found User: Me
Found Group: Admin
mkdir: /home/Me: File exists
chown: Me: Invalid argument
Found User: Bob
Found Group: User
chown: Bob: Invalid argument
CRASH-2:~ crash$ sh Usergroup.sh
Found User: Me
Found Group: Admin
chown: Me: Invalid argument
Found User: Bob
Found Group: User
chown: Bob: Invalid argument


when i run it i get invalid args for the chown dunno why but maybe now that i did all the leg work some one else can fix it since i am total noob in when it comes to shell scripts
 
09.19.2007 at 04:15PM PDT, ID: 19925164
here is the solution for my problem..

Create file user.data list all username for your users
mkdir /home
chmod -R 755 /home

#!/bin/sh

USER=`cat /etc/User.data`

for i in $USER ; do
mkdir  /home/$i
chown -R $i:`id -g $i` /home/$i
chmod 700 /home/$i

done
 
10.17.2007 at 07:23AM PDT, ID: 20093624
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I will leave the following recommendation for this question in the Cleanup topic area:
   PAQ with points refunded

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

Venabili
EE Cleanup Volunteer
 
10.21.2007 at 08:04PM PDT, ID: 20120548
PAQed with points refunded (500)

Computer101
EE Admin
Accepted Solution
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628