Welcome To My Blog
Showing posts with label nsa. Show all posts
Showing posts with label nsa. Show all posts

Sunday, January 2, 2011

Summary #5 - Network & System Administration (NSA)

root - super user with unrestricted access to all system resources and files
-has user ID, of 0 which is universally identified, belong to a user with supreme privileges.
-log in as root to add new users

Debian Note: 
When installing Ubuntu Linux systems-will be prompted to create
a primary user that is not root.
root user is created but no password is set-cannot log in as this user.
primary user can become the root(sudo su - )

Adding users
1) Arrange list of users into groups by function.
e.g: "parents", "children" and "soho".

Parents    Children     Soho

Paul       Alice        Accounts
Jane       Derek        Sales

Add the Linux groups to your server:

[root@bigboy tmp]# groupadd parents
[root@bigboy tmp]# groupadd children
[root@bigboy tmp]# groupadd soho

Add the Linux users and assign them to their respective groups:

[root@bigboy tmp]# useradd -g parents paul
[root@bigboy tmp]# useradd -g parents jane
[root@bigboy tmp]# useradd -g children derek
[root@bigboy tmp]# useradd -g children alice
[root@bigboy tmp]# useradd -g soho accounts
[root@bigboy tmp]# useradd -g soho sales

group with same name as the user is created without -g
first logs in-will be prompted for new permanent password

Each user's personal directory is placed in the /home directory.
directory name will be the same as their user name.

[root@bigboy tmp]# ll /home
drwxr-xr-x    2 root     root        12288 Jul 24 20:04 lost+found
drwx------    2 accounts soho         1024 Jul 24 20:33 accounts
drwx------    2 alice    children     1024 Jul 24 20:33 alice
drwx------    2 derek    children     1024 Jul 24 20:33 derek
drwx------    2 jane     parents      1024 Jul 24 20:33 jane
drwx------    2 paul     parents      1024 Jul 24 20:33 paul
drwx------    2 sales    soho         1024 Jul 24 20:33 sales

create password
passwd command
will be prompted once for old password and twice for the new one.
 
User root changing the password for user paul.
[root@bigboy root]# passwd paul
Changing password for user paul.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@bigboy root]#

unprivileged user paul would change his own password:
[paul@bigboy paul]$ passwd
Changing password for paul
Old password: your current password
Enter the new password (minimum of 5, maximum of 8 characters)
Please use a combination of upper and lower case letters and numbers.
New password: your new password
Re-enter new password: your new password
Password changed.

userdel-remove the user's record from /etc/passwd and /etc/shadow used in the login process(single argument:the username).
[root@bigboy tmp]# userdel paul

optional -r ->removes all the contents of the user's home directory.
[root@bigboy tmp]# userdel -r paul

How to Tell the Groups to Which a User Belongs?

Use the groups command with the username as the argument.

[root@bigboy root]# groups paul
paul : parents
[root@bigboy root]#

chown ->change the ownership of a file.
first argument=username and group ownership
separated by a colon (:) followed by the filename.
e.g.change ownership of the file named text.txt
from being owned by user root and group root to being owned by user testuser in the group users:

[root@bigboy tmp]# ll test.txt
-rw-r--r--  1 root root 0 Nov 17 22:14 test.txt
[root@bigboy tmp]# chown testuser:users test.txt
[root@bigboy tmp]# ll test.txt
-rw-r--r--  1 testuser users 0 Nov 17 22:14 test.txt
chown command with -r switch for it to do recursive searches down into directories to change permissions

sudo utility - allows users defined in the /etc/sudoers configuration file to have temporary access to run commands
commands can be run as user "root" /any other user defined in /etc/sudoers
sudo followed by the command's regular syntax.
commands run as sudo are logged in the log file /var/log/messages.

Temporarily Gaining root Privileges
e.g: user bob attempts to view the contents of the /etc/sudoers file,
Without sudo, the command fails:

[bob@bigboy bob]$ more /etc/sudoers
/etc/sudoers: Permission denied
[bob@bigboy bob]$

Bob tries again using sudo and his regular user password and is successful:

[bob@bigboy bob]$ sudo more /etc/sudoers
Password:
...
...
[bob@bigboy bob]$

Becoming root for a Complete Login Session

su command-allows regular user to become the system's root user
if they know the root password.
someuser@u-bigboy:~$ sudo su -
Password:
root@u-bigboy:~#

Downloading and Installing the sudo Package
installed by default
visudo-text editor that mimics vi editor->used to edit the /etc/sudoers configuration file.
uses the same commands as the vi text editor.
run as user root, no arguments:
[root@aqua tmp]# visudo

Summary #4 - Network & System Administration (NSA)

Linux Filesystem Management

badblocks -search disk or partition for badblocks. (badblocks device) (badblocks hda)
df - Shows disk free space on one or more filesystems. (df –k, df -h)
du - Shows how much disk space a directory and all its files contain. (du , du –sk , du –sh )
fsck - Filesystem check. Must not be run on a mounted file system. (fsck )
sync - Synchronize data on disk with memory. `sync' writes any data buffered in memory out to disk.
mount - mount a filesystem.  (mount , mount –a)
umount - Unmounts a filesystem. (umount )

Network Management Command

dnsdomainname -Show systems DNS domain name
hostname -show/set the name of your machine for networking
nisdomainname -Show/set systems NIS/YP domain name
ypdomainname - Show/set the system's NIS/YP domain name
arp -let the user read or modify their arp cache.
dig - Send domain name query packets to name servers for debugging or testing.
finger - Display information about the system users. Ex: finger Deepak
ftp -File transfer program. (ftp
ifconfig -Configure a network interface.
e.g: ifconfig eth0 address 172.31.2.2 netmask 255.255.0.0
ifdown - Shutdown network interface.
e.g: ifdown eth0
ifup -Brings a network interface up.
e.g: ifup eth0
netconf -GUI interactive program,let you configure a network on Redhat systems.
netconfig -GUI step by step network configuration program.
netstat - Displays information about the systems network connections,
(port connections, routing tables, and more)
"netstat -r" ->display the routing table. (netstat –rn)
nslookup - query DNS servers for information about hosts.
ping -Send ICMP ECHO_REQUEST packets to network hosts. (ping
route -Show or manipulate the IP routing table. (route, route add, route del)
showmount -Show mount information for an NFS server.
ssh -Secure Login (ssh )
tcpdump -Dump network traffic,Prints headers of packets that match the boolean expression. (tcpdump eth0)
telnet -User interface to the TELNET protocol, setting up a remote console session. (telnet )
traceroute -Print the route that packets take to the specified network host. (traceroute )

Communications commands (includes mail)

 
elm -Electronic mail.
pine -Program for internet news and e-mail, Can send documents, graphics, local & remote messages.
talk -Lets two parties talk simultaneously.
mail --send mail

System Management Command

Runtime level management
exit -Terminates the shell.
halt -Stop the system.
init -Process control initialization. (init 3)
logout -Log the user off the system.
poweroff -Brings the system down.
reboot -Reboot the system
runlevel -List the current and previous runlevel

shutdown
If system has many users, use the command shutdown -h +time ‘`,
time-time in minutes until the system is halted
message-short explanation of why the system is shutting down.
e.g:: # shutdown -h +10 'We will install a new disk. System should be back on-line in three hours.‘

passwd -Set user's password. (passwd, passwd )
quota -Display users' limits and current disk usage. (quota, quota )
quotaoff -Turns filesystem quotas off.
quotaon -Turns filesystem quotas on.
quotacheck -check filesystem for usage, and update the quota.user file.
edquota -edit user/group quotas. (edquota )

su -Single user login. (su -)
useradd -Create new user/update default new user information. (useradd –g -s -c –d
userdel -Delete user account & related files. (userdel )
usermod -Modify a user account.
users -Print the user names of users currently logged in.
wall -Send message to everybody's terminal. (wall “text message”)
who -Display the users logged in.
whoami -Print effective user id.

System Time
cal -Calendar. (cal, cal 2005)
date -Print/set the system date and time. (date, date MMDDhhmm[[CC]YY][.ss])
hwclock -Set/read the hardware CMOS clock.
uptime -Reports how long the system has been running.

Linux Job & Process Management


Linux Process Management
ps -Get -status of one/more processes.
PPID-parent process ID ;  

PID-process ID
Eg: ps ax |more to see all processes including daemons
Eg : ps –ef | grep
pstree -Display the tree of running processes.
pgrep -looks through the currently running processes and lists
the  process IDs which matches the selection criteria to stdout.
All the criteria have to match.

top  ->dynamic real-time view of a running system.
display system summary information,list  of  tasks currently  being managed by the Linux kernel

Tuesday, December 28, 2010

Summary #2 - Network and System Administration(NSA)

let's continue....


Desktop Familiarization

Linux desktop
1) Text Mode (6 consoles CTRL-ALT-F1[6]
2) GUI Mode CTRL-ALT-F7 
->GNOME(default desktop)
->KDE
switchdesk command - change desktop environment


partitioning-divide single hd into many logical drives
partition-contiguous set of blocks treated as independent disk


why multiple partitions?
reduce system failure


partition fields
1)device-partition's device name
2)start-sector where partition begins
3)end-sector where partition ends
4)size-partition's size(MB)
5)type-partition's type(ext2,ext3,vfat)
6)mount point-location within directory hierarchy where volume exists


filesystem type
ext2 — supports standard Unix file types (regular files, directories, symbolic links, etc).
ext3 — based on the ext2 filesystem with journaling- reduces time spent recovering a filesystem after a crash-no need to fsck the filesystem.
swap — support virtual memory. data is written to a swap partition when not enough RAM to store the data your system is processing.
vfat — compatible with Windows 95/NT long filenames on the FAT filesystem. 


IDE Disk Partitions
/dev/hda (Primary Master Disk)
/dev/hda1 (First Primary Partition)
/dev/hda2 (Second Primary Partition)
/dev/hdb (Primary Slave Partition)
/dev/hdb1
/dev/hdc (Secondary Master/Slave Partition)
/dev/hdc1
SCSI Disk Partitions
/dev/sda1, /dev/sda2
/dev/sdb1, /dev/sdb2
/dev/sdc1, /dev/sdc2


Software RAID (Redundant Array of Inexpensive Disk)
RAID 0 (Striping)
RAID 1 (Mirroring)
RAID 5 (Striping with Parity)
LVM (Logical Volume Manager)

Boot Loader
to load OS- BIOS  looks for instructions on the first sector of hd.
first sector of the hd resides master boot record (MBR)-boot loader is initialized .
additional files may be stored and read from a partition



Ai no ōku,
fanilzekazuyama

Summary #1 - Network and System Administration(NSA)

Since i'm taking 2 subjects only for this semester, i've decided to post a summary of what i've learnt in class. It will be easier for me to revise back before quizzes or exams. Hopefully it works coz when i was taking PMIT (Project Management in IT) during short semester, i always updated my blog (onestepclosertomygoal.blogspot.com) after each topic we learned. So.....I'm just hoping for the best since this is my final semester....I'll try my best. Here is the first summary.

UNIX
-multi-user, multi-tasking OS
-can have many users logged in simultaneously, each running many programs
-kernel-keep each process & user separate, regulate access to sys hardware (cpu,memory, disk, i/o)

Linux
-free Unix-type OS
-created by Linus Trovalds
-developed under GNU GPL
-distros(mandrake,redhat,fedora,suse,debian,ubuntu)

structure of standard directories in Unix/Linux
/bin-tools n other program
/dev-hardware devices
/etc-miscellaneous sys config, starup file,etc
/home-home dir
/lib-library files
/proc-current sys process
/root-superusers home dir
/sbin-sys admin tools/sys binaries
/tmp-temporary files
/usr-user tools n apps

INODE(index Node) table-maintain files and dir info(file-metadat,file permission, UID,GID,size,time stamps,etc)

Access Permission
file,dir apps permission:
permission  action      chmod option
read           view        r/4
write          edit         w/2
execute      execute    x/1

category of users:
u-owner/user
g-group
o-others/all users

view permission
ls -l

change to directory
cd directory1


present working directory
pwd


move to superior directory
cd..


absolute path
cd /home


return to user home directory
cd


make directory
mkdir directory1


remove directory(only if empty)
rmdir directory1


remove directory(everything)
rm -R directory1


copy file(must be in same directory otherwise path must be given)
cp file1 file2


move/rename file(must be in same directory otherwise path must be given)
mv file1 file2


remove file
rm file1


use wildcard(all file begin with h and end with c will be removed)
rm h*c


rm * (remove all file in working directory)


change ownership of file/dir permission
chown fanilze directory1
chown fanilze file1


change group of file/dir permission
chgrp group1 directory1
chgrp group1 file1


change dir/file permission
chmod ### file/dir


eg:
chmod 700 dir1 (only owner will have read, write, execute permission)
chmod ugo+rwx file1 (add owner, group, others permission read, write, execute)


summary pon panjang berjela...hahaha....huhuhu....janji paham....

Ai no ōku,
fanilzekazuyama