Custom Search

Wednesday, May 14, 2008

FTP access restrictions

When you first install Linux, it comes with a lot of Internet services running, including mail, telnet, finger and FTP. You really should disable all those that you don't need from /etc/inetd.conf and your startup scripts.
FTP may be very useful, but must be configured correctly. It can allow people to log into their accounts, it can allow anonymous users to login to a public software directory, and it can display nice messages to them.
The files that you will probably want to modify are /etc/ftpusers and /etc/ftpaccess.
The file /etc/ftpusers is very simple. It lists the people that will not be allowed to use FTP to your system. The root account, and other system accounts should be in that file.
The file /etc/ftpaccess is a bit more complex and controls the behaviour of the FTP server. It tells it what to use as README file to display on a directory listing, what kind of logs to create and what messages to display.
Note that if you create an anonymous FTP area, you will need to read the FTP man page and do exactly what it tells you to avoid possible security risks.

Linux and NT booting

Some people choose to have both Windows NT and Linux on the same system. Windows NT has its own boot loader called NTLDR and Linux has LILO. Which should go on the MBR?
The safest way is to install Windows NT first, and give it the MBR. Then, when you install Linux, tell LILO to install on the Linux partition. Also set the Linux partition as the active partition. When the system boots, LILO will be loaded, and if you want to boot Windows NT, then LILO can load the MBR with NTLDR in it.
There is a mini HOWTO text covering this subject available at
http://metalab.unc.edu/pub/Linux/docs/HOWTO.

Multiple kernels choices

When you compile a new kernel, you will often change your configuration. This means you may forget to include an important driver, like the IDE driver, or otherwise make your system unbootable. The solution is to always keep your old kernel.
When you compile your kernel, the compilation procedure will often copy your old kernel into vmlinuz.old.
If it does not, you can do it manually. What you should do is add an entry to /etc/lilo.conf allowing you to boot your old kernel. You should view the lilo man page for the complete syntax. You could also add entries for different kernels, for example if you want to have an older stable version of the kernel and the newest development version on your system.
Note that some distributions name their kernel with the version they represent. For example, your current kernel may be /boot/vmlinuz-2.0.36-0.7

Default file permissions

When you create a file, the system gives it default permissions. On most systems the permissions are 755 (read, write and execute for the owner, and read and execute for others).
This default is setup with the umask command. To use the command, you need to find the right octal number to give it. The permissions in the umask are turned off from 666. This means that a umask of 022 will give you the default of 755. To change your default permissions from 755 to 700, you would use this command:
umask 077

How to change the Linux boot mode.

When a Linux system boots, it loads the kernel, all its drivers, and the networking servers, then the system will display a text login prompt. There, users can enter their user names and their passwords. But it doesn't have to boot this way.

There are 3 modes defined in most Linux distributions that can be used for booting. They are defined in /etc/inittab and have specific numbers. The first mode, also called runlevel 1, is single user mode. That mode will only boot the system for 1 user, with no networking. Runlevel 3 is the default mode. It will load the networking servers and display a text login prompt. Runlevel 5 is the graphical mode. If you have X Window installed and configured, you can use it to display a graphical login prompt.

The way to change this is to edit /etc/inittab and change the initdefault line:
id:3:initdefault:

Changing a 3 to a 5 will make the system display a xdm graphical screen on bootup.

The Process Status command: ps

ps command is used to display the process attributes. The command reads through the kernel's data structures and process tables to fetch the characterstics of processes. e.g. if you execute the command immediately after logging in you will see the following:

$ ps
PID TTY TIME CMD
291 console 0:00 bash

Inorder to get a detailed listing showing the parent of every process you can use the -f (full) option:

$ ps -f
UID PID PPID C STIME TTY TIME CMD
sam 257 191 0 10:25:12 console 0:00 vi create_user.sh
sam 191 1 0 08:22:23 console 0:00 -bash
sam 268 267 0 10:25:16 console 0:00 /user/bin/bash -i

As you can see the parent (PPID) and the owner (UID) of every process. The login shell (PID 191) has the PPID 1, the second process of the system. The first process is always init having PID 0.