I'm writing a small shell script to add ftp users and create them a public html directory. all works fine except for when I try to write to a small html file:
this is my script:
Code:
#! /bin/bash
# get name
echo -n "Enter the new users name: "
read -e username
# create user and add them to ftp group
useradd $username
adduser $username ftpusers
passwd $username
# make them a public_html dir
mkdir /home/${username}
mkdir /home/${username}/public_html
# stick a default index page in it
"<h1>Default page for $username</h1><h5>You should change this file with your own content!</h5>" > /home/${username}/public_html/index.php
# give the user ownership and permissions
chown $username /home/${username}/public_html
chmod 755 /home/${username}/public_html
# hopefully everything went smoothly
# i'll add some error checking in later
echo "User $username created."
and this is the output when it's run
Code:
root@ubuntu:/home/admin/bin# ./new_ftp_user
Enter the new users name: anotheruser
Adding user `anotheruser' to group `ftpusers'...
Done.
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
./new_ftp_user: line 17: <h1>Default page for anotheruser</h1><h5>You should change this file with your own content!</h5>: No such file or directory
User anotheruser created.
can anyone help with that error i'm getting on line 17?
thanks,
chris