Dave Taylor answers free tech support questions about a wide variety of business and technical topics, including blogging, iphone help, ipod help, AdSense, MySpace, Sony PSP help, Mp3 players, Windows XP, Windows Vista, Linux, SEO, Mac OS X, Facebook, Twitter and LinkedIn.

Getting the "adduser" script to work on Linux

A reader writes:
" Hi, I'm a very beginner at shell scripting and unix/linux. I have your book (Wicked Cool Shell Scripts) and it is really great. So far I've done two or three, Inpath is the one i use most. I'm going make a user for an ftp account so my friends can upload/download songs and other files. I decided to use your adduser script for the job but when i run the script i get an erorr like - /etc/passwd : permission denied. How do i give the script permission to write to /etc/passwd? Sorry if this is an obvious question but i couldn't find an answer. I used chmod 755 and ran it as root. By the way, i really like the site and book cover, i wish all linux/programming manuals had really cool covers."

Dave's Answer: First off, thanks for the kind words!

In terms of your problem, I would want to see the permissions of both the file /etc/passwd, and, since it needs to add information to it too, /etc/shadow too.

If you're running as root, theoretically, all should be well, but Linux isn't 100% predictable, so...

Please respond with that information as a comment to this thread and we'll continue to debug your problem!



Help others find this article at Del.icio.us, Digg, Netscape, Reddit, and Stumble Upon    

Subscribe!

Never miss another useful Q&A article again! Subscribe to AskDaveTaylor with Google Reader.

Comments

how to find root password using shell script?

Posted by: v at November 26, 2005 10:10 AM

Well, gosh, hmmm... if you want to learn how to hack into a Linux system, I think you've come to the wrong place. :-)

Posted by: Dave Taylor at November 26, 2005 2:38 PM

I have the same error:


-rw-r--r-- 1 root root 1117 Jul 24 11:32 shadow
-rw-r--r-- 1 root root 1616 Jul 24 11:31 passwd

Posted by: joey at July 24, 2008 5:27 AM

Hi i wanted to know how will i write a post installation script in a kickstart file in linux to changes a few words in the inittab file for example "kernel" to kerne!" and also the grub.conf and the fstab entries as well. coz i want to create an automated troubleshooting situations for myself

Posted by: Vinit at September 3, 2008 3:24 PM


I have a lot to say, but ...
Starbucks coffee cup I have a lot to say, and questions of my own for that matter, but most of all I'd like to say thank you for all your efforts on this Web site by buying you a chai!

I do have a comment, now that you mention it!









Remember personal info?


Please note that I will never send you any unsolicited commercial email. Ever.

While I'm at it, please note that by submitting a question or comment you're agreeing to my terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site.









Uniblue: Free Virus Scan

Search
Find just the answers you seek from among our 1700+ free tech support articles by using our Lijit search engine.


Member of the B5Media Network

Help!





Subscribe to
Ask Dave Taylor!

Add to Google Reader
Add to My Yahoo!
Subscribe in NewsGator Online

RDF   XML

Free Updates!
Sign up and get free weekly updates and special offers on books, seminars, workshops and more.


Recent Entries
Join the List!
Join my author info mailing list, where you'll learn about my upcoming books, speaking gigs, and more!


Book Links
© 2002 - 2008 by Dave Taylor. All Rights Reserved.

Note: This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this web site or on any linked site.

[whiteboard marker tray]