I’m using PuTTY as a console for my nas4Free file server.
Note up-arrow and down-arrow keys show previous text input in the command line.
You will notice aliases in
.cshrc for some of the
ls commands (they are very convenient). You can create other aliases by editing
.cshrc. You can make these aliases available to all users on the system by putting them in the system-wide
csh configuration file,
Useful Unix commands in NAS4Free
Note.. spaces and case sensitivity for all comands
See the unix manual ls command.
- ls / List the contents of your root directory.
- ls ../ List the contents of the parent directory
- ls ~ List the contents of your home directory
- ls -F Lists the files in the current directory with a * after executables, a / after directories, and an @ after symbolic links
- ls -l Lists the files in long format —size, date, permissions.
- cd .. backs up one level; note the space after cd.
- cd /usr/local goes there.
- cd ~ goes to the home directory of the person logged in—e.g., /usr/home/jack. Try cd /cdrom, and then ls, to find out if your CDROM is mounted and working.
to move a directory
# cd /home/vivek
# mv data/ /nas/home/vivek/archived/
filename on screen.
Shows file space and mounted systems.
Shows processes running. ps ax is a narrower form.
chmod to alter the permissions of the folder, the general way to use
chmod would be something like:
chmod 700 Dropbox
This would emulate the permissions we have here, 7 is made up of 4 for read, 2 for write and 1 for execute (so 6 is read/write, 5 is read/execute etc etc), the other way sometimes used for scripts etc would be:
chmod a+x foobar
This would set the execute bit (x) for all users (a), using “a-x” would remove the execute bit for all users.
Change root directory
In order to chroot a user to a directory the permissions on that directory all the way back to the mountpoint must be exactly as required by chroot. The default permissions are not correct. Use the following shell commands executed as root to fix this. I suggest the following as an example taken from the HOWTO I had posted on the FreeNAS forum some time ago. You can change it as you wish, however, if any of the permissions and ownerships are even slightly wrong IT WILL NOT WORK. The below assumes a user and group named sftp with the user sftp being the one who is being chrooted.
mkdir -p /mnt/disk1/chroot/sftp chown -R root:wheel /mnt/disk1/chroot/sftp chmod -R 755 /mnt/disk1/chroot/sftp mkdir /mnt/disk1/chroot/sftp/sftp chown sftp:sftp /mnt/disk1/chroot/sftp/sftp