Difference between revisions of "Linux Notes"
From OpenEMR Project Wiki
(49 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
==General== | |||
*[http://tldp.org The Linux Documentation Project] | |||
*[http://www.thegeekstuff.com/2010/11/50-linux-commands/ TheGeekStuff - 50 Most Frequently Used Linux Commnads] | |||
<br><br> | |||
==LAMP Server== | |||
*[http://www.aboutdebian.com/internet.htm About Debian Linux - How to Set Up Debian Linux Internet Server] | |||
*Lamp Server Notes | |||
:*[[Apache2 Notes]] | |||
:*[[MySQL Notes]] | |||
:*[[PHP Notes]] | |||
<br><br> | |||
==Text Editors - Command Line== | ==Text Editors - Command Line== | ||
=====vim===== | =====vim===== | ||
Line 6: | Line 20: | ||
=====nano===== | =====nano===== | ||
:*Derived from pico, more features than pico, easier to use than vim. | :*Derived from pico, more features than pico, easier to use than vim. | ||
:*Control-Y = Page Up. Control-V = Page Down. | |||
=====emacs===== | =====emacs===== | ||
<br><br> | |||
=====jed===== | |||
:*Menu based text editor. Yes, menus in the command line! | |||
<br><br> | |||
==Mail Readers - Command Line== | |||
=====mail===== | |||
=====mutt===== | |||
<br><br> | <br><br> | ||
==Viewing Files== | ==Viewing Files== | ||
<pre style="font-size: 130%; margin: 0 2em 0 2em;"> | |||
less [FILENAME] | |||
</pre> | |||
<br><br> | <br><br> | ||
==FTP Servers== | |||
====vsftp==== | |||
:'''Files''' | |||
{| style="margin: 0 2em 0 2em;" | |||
|- | |||
| width="250" | <tt style="font-size: 120%">/etc/vsftpd.conf</tt> | |||
| width="400" | Config File | |||
|- | |||
| <tt style="font-size: 120%">/etc/ftpusers</tt> | |||
| File with a list of users that are NOT allowed FTP access | |||
|} | |||
:After Config Changes: <tt style="font-size: 130%">sudo etc/init.d/vsftpd restart</tt> | |||
<br> | |||
:'''Configuration File Settings''' | |||
{| style="margin: 0 2em 0 2em;" | |||
|- | |||
| width="400" | <tt style="font-size: 120%">local_enable=YES</tt> | |||
| width="400" | Allow Authentication of Users | |||
|- | |||
| <tt style="font-size: 120%">write_enable=YES</tt> | |||
| Allow Upload of Files | |||
|- | |||
| <tt style="font-size: 120%">chroot_local_user=YES</tt> | |||
| Limit users to their home directory. | |||
|- | |||
| <tt style="font-size: 120%">chroot_list_enable=YES</tt> | |||
| Limit a list of users to their home directories. | |||
|- | |||
| <tt style="font-size: 120%">chroot_list_file=/etc/vsftpd.chroot_list</tt> | |||
| Location of the list of users to limit. | |||
|- | |||
| <tt style="font-size: 120%">ssl_enable=Yes</tt> | |||
| Enable FTP over SSL (FTPS). | |||
|- | |||
| <tt style="font-size: 120%">rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem</tt> | |||
| Location of SSL Certificate. | |||
|- | |||
| <tt style="font-size: 120%">rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key</tt> | |||
| Location of SSL Key. | |||
|} | |||
<br><br> | |||
====proftpd==== | |||
<br><br> | |||
==SFTP== | |||
<pre style="font-size: 130%; margin: 0 2em 0 2em;"> | |||
sftp username@192.168.1.1 | |||
</pre> | |||
====Commands==== | |||
{| style="margin: 0 2em 0 2em;" | |||
|- | |||
| width="175" | <tt style="font-size: 120%">pwd / lpwd</tt> | |||
| width="500" | Show current REMOTE directory / Show current LOCAL directory. | |||
|- | |||
| <tt style="font-size: 120%">ls</tt> | |||
| List contents of REMOTE working directory. | |||
|- | |||
| <tt style="font-size: 120%">lls</tt> | |||
| List contents of LOCAL working directory. | |||
|- | |||
| <tt style="font-size: 120%">ls -la</tt> | |||
| List contents of LOCAL working directory. List ALL, LONG FORMAT. | |||
|- | |||
| <tt style="font-size: 120%">cd / lcd</tt> | |||
| Change remote directory / Change local directory. | |||
|- | |||
| <tt style="font-size: 120%">get remoteFile</tt> | |||
| Download file from current remote directory and place in current local directory. | |||
|- | |||
| <tt style="font-size: 120%">get remoteFile localFile</tt> | |||
| Copy remote file, place it in local directory, and rename it . | |||
|- | |||
| <tt style="font-size: 120%">get -r someDirectory</tt> | |||
| Recursive command to copy entire directory. | |||
|- | |||
| <tt style="font-size: 120%">put localFile</tt> | |||
| Upload file from current LOCAL directory and place in current REMOTE directory. | |||
|- | |||
| <tt style="font-size: 120%">bye</tt> | |||
| Quit. | |||
|} | |||
<br> | |||
==NFS File Server== | |||
====Server==== | |||
*[http://tldp.org/HOWTO/NFS-HOWTO/server.html The Linux Documentation Project -- NFS How To] | |||
*Package: '''nfs-kernel-server''' | |||
*Configure the Directories to be Exported by adding them to: | |||
::<tt style="font-size: 120%">/etc/exports</tt> | |||
*Exports File Configuration Examples: | |||
<pre style="font-size: 130%; margin: 0 2em 0 2em;"> | |||
/ubuntu *(ro,sync,no_root_squash) | |||
/home *(rw,sync,no_root_squash) | |||
/home 192.168.1.0/255.255.255.0(rw,no_subtree_check,no_root_squash,sync,insecure) | |||
</pre> | |||
<br> | |||
====Client==== | |||
*Package: '''nfs-common''' | |||
*Create a Mount Point: <tt style="font-size: 120%;">sudo mkdir -p /mnt/NFS/home</tt> | |||
*Mount Shared Directory: <tt style="font-size: 120%;">sudo mount -t nfs -o resvport 192.168.1.1:/home /mnt/NFS/home</tt> | |||
*Unmount Shared Directory: <tt style="font-size: 120%;">sudo umount /mnt/home</tt> | |||
<br><br> | |||
==SSH Server== | |||
====Configure==== | |||
<pre style="font-size: 130%; margin: 0 2em 0 2em;"> | |||
sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.default | |||
sudo chmod a-w sshd_config.default | |||
sudo nano /etc/ssh/sshd_config | |||
[Change: PasswordAuthentication yes] | |||
sudo restart ssh | |||
</pre> | |||
<br><br> | |||
==Directory Structure== | |||
<table width=700 cellspacing=0 cellpadding=0> | |||
<tr><td width=80><td width=620> | |||
<tr><td>'''bin'''<td>Essential user command binaries. | |||
<tr><td>'''boot'''<td>Static files of the boot loader. | |||
<tr><td>'''cdrom''' | |||
<tr><td>'''dev'''<td>Device files. | |||
<tr><td>'''etc'''<td>Host-specific CONFIGURATION files, i.e. preferences. | |||
<tr><td><td>Startup, shutdown, start, stop scripts for every individual program. | |||
<tr><td>'''home'''<td>User home directories. | |||
<tr><td>'''lib'''<td>Essiential shared libraries and kernel modules. | |||
<tr><td>'''media'''<td>Mount point for removable media. | |||
<tr><td>'''mnt'''<td>Mount point for a temporarily mounted filesystem. | |||
<tr><td>'''opt'''<td>Add-on application software packages. | |||
<tr><td>'''proc'''<td>Process information. Virtual filesystem documentation kernel and process status as text files. | |||
<tr><td>'''root'''<td>Home directory for the root user. | |||
<tr><td>'''run''' | |||
<tr><td>'''sbin'''<td>System binaries. | |||
<tr><td>'''srv'''<td>Data for services provided by the system. | |||
<tr><td>'''sys''' | |||
<tr><td>'''usr'''<td>Multi-user utilities & applications. | |||
<tr><td>'''var'''<td>Variable files. The contents of the files here is expected to grow. | |||
<tr><td><td>Contains log, lock, spool, mail, and temp files. | |||
<tr><td><br> | |||
</table> | |||
<br> | |||
==Miscellaneous Commands== | ==Miscellaneous Commands== | ||
=====Enable Root User===== | |||
<pre style="font-size: 130%; margin: 0 2em 0 2em;"> | |||
sudo passwd root | |||
</pre> | |||
<br> | |||
=====Disable Root User===== | |||
<pre style="font-size: 130%; margin: 0 2em 0 2em;"> | |||
sudo passwd -dl root | |||
</pre> | |||
<br> | |||
=====Reboot===== | |||
<pre style="font-size: 130%; margin: 0 2em 0 2em;"> | |||
sudo reboot | |||
</pre> | |||
<br><br> | <br><br> |
Latest revision as of 06:23, 5 June 2014
General
LAMP Server
- About Debian Linux - How to Set Up Debian Linux Internet Server
- Lamp Server Notes
Text Editors - Command Line
vim
- Highest learning curve, most powerful.
- vi Editor Commands
nano
- Derived from pico, more features than pico, easier to use than vim.
- Control-Y = Page Up. Control-V = Page Down.
emacs
jed
- Menu based text editor. Yes, menus in the command line!
Mail Readers - Command Line
mutt
Viewing Files
less [FILENAME]
FTP Servers
vsftp
- Files
/etc/vsftpd.conf | Config File |
/etc/ftpusers | File with a list of users that are NOT allowed FTP access |
- After Config Changes: sudo etc/init.d/vsftpd restart
- Configuration File Settings
local_enable=YES | Allow Authentication of Users |
write_enable=YES | Allow Upload of Files |
chroot_local_user=YES | Limit users to their home directory. |
chroot_list_enable=YES | Limit a list of users to their home directories. |
chroot_list_file=/etc/vsftpd.chroot_list | Location of the list of users to limit. |
ssl_enable=Yes | Enable FTP over SSL (FTPS). |
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem | Location of SSL Certificate. |
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key | Location of SSL Key. |
proftpd
SFTP
sftp username@192.168.1.1
Commands
pwd / lpwd | Show current REMOTE directory / Show current LOCAL directory. |
ls | List contents of REMOTE working directory. |
lls | List contents of LOCAL working directory. |
ls -la | List contents of LOCAL working directory. List ALL, LONG FORMAT. |
cd / lcd | Change remote directory / Change local directory. |
get remoteFile | Download file from current remote directory and place in current local directory. |
get remoteFile localFile | Copy remote file, place it in local directory, and rename it . |
get -r someDirectory | Recursive command to copy entire directory. |
put localFile | Upload file from current LOCAL directory and place in current REMOTE directory. |
bye | Quit. |
NFS File Server
Server
- The Linux Documentation Project -- NFS How To
- Package: nfs-kernel-server
- Configure the Directories to be Exported by adding them to:
- /etc/exports
- Exports File Configuration Examples:
/ubuntu *(ro,sync,no_root_squash) /home *(rw,sync,no_root_squash) /home 192.168.1.0/255.255.255.0(rw,no_subtree_check,no_root_squash,sync,insecure)
Client
- Package: nfs-common
- Create a Mount Point: sudo mkdir -p /mnt/NFS/home
- Mount Shared Directory: sudo mount -t nfs -o resvport 192.168.1.1:/home /mnt/NFS/home
- Unmount Shared Directory: sudo umount /mnt/home
SSH Server
Configure
sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.default sudo chmod a-w sshd_config.default sudo nano /etc/ssh/sshd_config [Change: PasswordAuthentication yes] sudo restart ssh
Directory Structure
bin | Essential user command binaries. |
boot | Static files of the boot loader. |
cdrom | |
dev | Device files. |
etc | Host-specific CONFIGURATION files, i.e. preferences. |
Startup, shutdown, start, stop scripts for every individual program. | |
home | User home directories. |
lib | Essiential shared libraries and kernel modules. |
media | Mount point for removable media. |
mnt | Mount point for a temporarily mounted filesystem. |
opt | Add-on application software packages. |
proc | Process information. Virtual filesystem documentation kernel and process status as text files. |
root | Home directory for the root user. |
run | |
sbin | System binaries. |
srv | Data for services provided by the system. |
sys | |
usr | Multi-user utilities & applications. |
var | Variable files. The contents of the files here is expected to grow. |
Contains log, lock, spool, mail, and temp files. | |
Miscellaneous Commands
Enable Root User
sudo passwd root
Disable Root User
sudo passwd -dl root
Reboot
sudo reboot