Adding Users
From WL-HDD Wiki
| WL-HDD Contents |
|---|
| What is the WL-HDD |
| Features |
| Pro's/con's |
| Reviews |
| Hacking |
| Inserting the HDD |
| Hacking Guides |
| Basic setup guides |
| Packages guides |
| Requests |
| Troubleshooting |
| This Wiki |
| Credits |
| Editing help |
| Contact Me |
Contents |
[edit] Prerequisites
To complete this guide, the following is assumed:
| You are running Oleg's firmware (1.9.2.7-6b or later) |
| You have harddisk partitions up and running with an extended filesystem mounted to /opt |
| You have installed the Ipkg package system. |
| You have configured your partitions to automount. |
If you want FTP access from a computer outside your LAN then you will need to have completed the FTP_from_WAN guide.
[edit] Creating New Users
Users are created on the WL-HDD with the /etc/passwd file
cd /etc nano passwd
You will now see something like this (note that I have blanked the passwd hashes!!)
jono:$###################1:0:0:root:/usr/local/root:/bin/sh nobody:x:99:99:nobody:/:/sbin/nologin
if we break this down, the format of these lines is as follows:
username:passwordhash:UserID:GroupID:comment:/my/home/directory/:/shellpath
Unless you know the password hash for your password, it is easier to leave it blank and we will make one in a minute.
Now, lets make a new user, for this guide, we will call the user 'share' as this user will be accessing shared features such as samba and FTP Go to the bottom of the passwd file and add the following line.
share::1001:1001:shareuser:/opt/home/share:/bin/sh
Note that we have given the user 'share' shell access. If you want to disable this:
replace /bin/sh with /sbin/nologin
Now we need to create a group for the user 'share', we will call this group 'users' Save the passwd file and quit:
Ctrl + O Ctrl + X
[edit] Passwords
Now we make the password for the user 'share', type:
passwd share password password (again)
If you open the /etc/passwd file now, there will be a hash between the two :: that we inserted ourselves.
[edit] Groups
Now lets set up groups: Open group file
nano /etc/group
Add the following line
users::1001:share
the format for this is
groupname:password:groupID:users,separated,by,commas
Save this file and exit
Ctrl + O Ctrl + X
[edit] Saving Files
What we need to do is include these files in the /usr/local/ directory. To do this, we place references to the file /etc/group and /etc/passwd in a file called /usr/local/.files
echo "/etc/passwd" >>/usr/local/.files echo "/etc/group" >>/usr/local/.files
now we can save changes to flash
flashfs save
It is important to note that these two files we have edited are not in the /usr/local/ directory or on our hard drive and therefore, if we use the:
flashfs save flashfs commit flashfs enable reboot
process, the changes will be lost.
the following should be displayed
[jono@asus root]$ flashfs save tar: Removing leading '/' from member names etc/passwd etc/group tmp/local/ tmp/local/sbin/ tmp/local/sbin/post-firewall tmp/local/sbin/post-boot tmp/local/etc/ tmp/local/etc/dropbear/ tmp/local/etc/dropbear/dropbear_dss_host_key tmp/local/etc/dropbear/dropbear_rsa_host_key tmp/local/etc/no-ip2.conf tmp/local/.files tmp/local/root/
notice that our two edited files are now included! Now lets commit and enable and reboot
flashfs commit flashfs enable reboot
Note that we cannot yet login as this user as the home directory has not yet been created.
[edit] Make the home directory
- Login via telnet.
make the home directory and change the owner to 'share' and the group to 'users'. Set access rights.
mkdir -p /opt/home/share chown share /opt/home/share chgrp users /opt/home/share chmod 770 /opt/home/share
This has given full read, write, execute rights to 'share' and anybody in the 'users' group. If you do not want to give everyone in the 'users' group full access, replace 770 with:
750 (for read and execute only) 740 (for read only) 700 (for no 'users' access)
Now login as 'share'
login share password
Enter the following
pwd (print working directory)
This should be the return
/opt/home/share
Try making the 'hello world' file
touch helloworld
List the folder contents
ls
The file should be listed!
Thats about it! Another thing to note is that you will not be able to make changes outside the /opt/home/share directory because you will not have the user rights to do this.
