Intranet Page

Linux Commands

Date: April 26, 2006

This page: linux_commands.htm

Intranet Home

 

Add user

 

useradd –m userid

User Delete (scorched earth option)

userdel –r userid

Set password for userid

 

passwd userid

Create samba user list from regular user list

cat /etc/passwd | /usr/bin/mksmbpasswd.sh > /etc/samba/smbpasswd

Add password for samba user

smbpasswd userid

 

 

 

restart most or all processes

/etc/init.d/xinetd restart

Super User

su -  the dash ensures you get the super user’s command set

 

 

Mount

To mount a network file system from the command line

mount 192.168.250.89:/mnt/server/directory /mnt/mountpoint

Mount in fstab

192.168.250.89:/mnt/server  /mnt/server nfs auto 0 0

df –h

Report the amount of file space used and available. Use the –h option as it provides output that a human being can understand!

 

Install grub boot loader

grub-install /dev/hd?

format drive

mkfs –t ext3 /dev/hdb?

Working with Files

Erasing Things

rmdir -

 

Delete a directory tree and all files and subdirectories

 

rm

-r

-f

-d

rm –rfd

rm –rfdv

rm –rfd &

Remove or delete files and directories

Recursive down directory tree

Force (i.e. don’t ask for confirmation)

Remove directories

Get’s rid of a directory tree including starting directory

Get’s rid of a directory tree including starting directory – Verbose

Get’s rid of a directory tree including starting directory – Do in the background.

cp –fprv

 

Copy a tree while maintaining ownership settings.  NOTE: This does not quite work like xcopy. If you list the source as a directory only, it will CREATE that directory and put it in the source directory rather than starting at the files in the source directory as would xcopy. Have specified force, keep permissions and ownership settings, recursive, verbose

 

cp –pruv --reply=yes

Only copy files where the source date is newer than the destination date.

 

ln –s directory shortcut

copy link directory

Background ftp downloads from command line: use ncftp

See pages 335 thru 336 of the RedHad 8 book.

bgget target_file_on_remote_server

jobs – to display queued download jobs

bgstart – to start the background jobs

when logging into a remote server, no need to specify anonymous userid and password, ncftp does it for you!!

Samba Server

 

Restarting: /etc/init.d/smb restart

Creating new password list: cat /etc/ passwd | /usr/bin/mksmbpasswd.sh > /etc/samba/smbpasswd

Setting samba to come on automatically at bootup: chkconfig smb on

Adding or changing a password: smbpasswd userid

 

 

Network File System

restart network file system

restart network file system file lock

turn on automatic start up

starting nfs

Configuration Files

 

/etc/init.d/nfs restart

/etc/init.d/nfslock restart

chkconfig nfs on
chkconfig nfslock on

/etc/init.d/nfs start
/etc/init.d/nfslock start

You need to edit BOTH the exports file and the hosts file in order for nfs to work properly.

 

VSFTP (Very Secure FTP)

Steps to get it going

 

Configuration File

Turn OFF Anonymous login

To stop FTP access to parent directories above users home

ASCII Download

Blocking users

 

 

Change the line disable = yes to disable = no in the following file: /etc/xinetd.d/vsftpd

Restart the xinetd server: /etc/init.d/xinetd restart

/etc/vsftpd.conf

Set line anonymous_enable=NO

Add the following line to the vsftpd.conf file: chroot_local_user=YES

You might want to enable ASCII download by setting: ascii_download_enable=YES, and ascii_upload_enable=YES

Use the following file to block users that have a regular account on the server from FTP access: /etc/vsftpd.user_list

 

Formatting and Creating Boot Disks

making a boot floppy

formatting (make file system)



mkbootdisk –device /dev/fd0 kernel number (Grub I believe but it may also work with Lilo – need to test)

mkfs –v –t fstype /dev/hd?? (fstype can = ext2, ext3, vfat, vfat32, etc; -v means verbose mode)

 

 

Turning Telnet Server on in RedHat 8

Enable it in the following file: /etc/xinetd.d/telnet