Tuesday, November 22, 2011

Tips 8: FTP ACL ?

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.

Tips: 7 what is the Default 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.

Tips: 6 what is the 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

Tips: 5 how to allow normal users to run root's command ?

When a user starts a command, it runs with the permissions of that user. What if you want to allow them to run some commands with root permissions? You can, and that's called suid.
You can set a command to be suid root with the chmod command. This will make it run as root even if a user starts it. Here is how to set commandname suid root:

chmod +s /path/commandname

Note that you must be very careful with this option. If the command has any security hole, or allows the user to access other files or programs, the user could take over the root account and the whole system.

Tips: 4 How to allow user to mount the drives ?

By default, Linux does not allow users to mount drives. Only root can do it, and making the mount binary suid root is not a good idea. With a special command in the /etc/fstab file, you can change that.

This is a typical line for the fd0 (A:) drive in /etc/fstab:

/dev/fd0 /mnt auto noauto,user 1 1

The keywords here are noauto and user. Noauto tells mount not the try to mount a diskette on boot, and user allows any user to mount the drive into /mnt. The auto keyword is also interesting. It tells mount to try to find out which file system is on the diskette.

Tips: 3 How to create swap File ?

You are in a situation where you need more swap. what do you do - Reinstall ???

No et all,

The trick is to make a file and then tell the swapon program to use it. Here's how to create, for example, a 64 megs swap file on your root partition

dd if=/dev/zero of=/swapfile bs=1024 count=65536

This will make a 64 megs (about 68 millions bytes) file on your hard drive. You now need to initialize it:

mkswap /swapfile 65536
sync

And you can then add it to your swap pool:

swapon /swapfile

With that you have 64 megs of swap added. Don't forget to add the swapon command to your startup files so the command will be repeated at each reboot.

Tips: 2 Swap and memory

One of the most critical setting is Linux's swap space. During the installation, you will need to create a swap partition.

What size should the partition be?

It depends on 2 things:
The size of your hard drive and the size of your RAM memory.

The less RAM you have, the more swap you will need. Usually you will want to set your swap space size to be twice the RAM size, with a maximum of 126 megs. This of course requires you to have a hard drive with enough free space to create such a partition.

If you have 32 megs of RAM, making the swap space 64 megs or even 128 megs is very important. You will need it. If you have 128 megs of RAM on the other hand, you won't need much swap because the system will already have 128 megs to fill before using swap space. So a swap partition of 128 megs or even 32 megs could be enough.

You can update/modify/add more later.