Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Hey everyone, I'm developing my first linux shell script and for some reason I can't get it to execute. The script is designed to create new users on the system.
I've placed the script in a /root/bin (a directory I created), and changed the permissions to 0750. When I try to execute the script from the root prompt, I get:
[root@coupweb bin] #./newuser tim
: bad interpreter : No such file or directory
What does this mean? I've included the script below if that helps.
Once again, thanks so much.
# newuser script
# makes new user on coupweb.newcomb.virginia.edu
# create user and prompt for password
# add user apache (http server) to user's group
# sets group id for user's default group
tid=`id -g $1`
# defines default entry in /etc/group
# defines modified entry in /etc/group with user apache added
# replaces fromStr with toStr in /etc/group
replace $fromStr $toStr -- /etc/group
# make public_html and cgi-bin directories with u=rwx,g=rx,o=rx
mkdir ~$1/public_html -m 0755
mkdir ~$1/public_html/cgi-bin -m 0755
# add user to ftp log
echo $1 >> /etc/vsftpd.chroot_list
The ./newuser tells the shell to execute the script with the name newuser in the current directory. Unless you're in /root/bin, this is not going to work. Simply use newuser or /root/bin/newuser if you want to be explicit about it.
Distribution: LFS 5.0, building 6.3, win98se, multiboot
That error message can be caused by a permission problem. I'd check the perms on the /root and /root/bin directories. Also, if you use several partitions the options on the partition in which /root/bin resides needs to be mounted with the exec option.
Hmm...using both 'newuser' and '/root/bin/newuser' didn't work--both gave me the bad interpreter error from before. Neither did cd'ing to the /root/bin directory and then using newuser and ./newuser.
Also, the permissions on /root are 0750 and the perms on /root/bin are 0750. This seems to be what I want--root can rwx the directories, the admins group can only read and execute in the directories, and other users cannot access the directories (I did this for security reasons). I am not using any partitions (except /swap and /), so I'm not sure how that plays a role.
After some googling, I figured out my problem....I had developed the script in Notepad on my Windows box at home and then ftp'd it to the linux box at work, and I had forgot that Windows leaves '\r' carriage returns that don't show up when I looked at the file on my linux box. I used replace to get rid of them, and now everything works fine.
Don't worry, as soon as I get some more familiarity with Linux, I'll be switching over at home too.