FreeBSD > Becoming super user (su) or enabling su access to user

November 15th, 2010 by upa_kid 
The superuser is a privileged user with unrestricted access to all files and commands. The superuser has the special UID (user ID) 0. You need to become super user (root) only when tasks need root permissions. Here is how to become super user: 1) At shell prompt type su and press enter key, when prompted for password supply root user password: $ su password: # 2) To exit super user status type exit...

FreeBSD >Sending a Message to All Users on a System

November 15th, 2010 by upa_kid 
You can use the wall command to send a message to every user on a system. General syntax of wall command is as follows: wall Message Message … …. .. When the message is complete, press Control-D. 1) To display message “Disk failure system will be down for 30 minute” to all users use wall as follows: # wall Disk failure system will be down for 30 minute –UNIX Admin –MyCorp.com When...

FreeBSD >Sending a Message to All Users on a Remote UNIX/Linux/FreeBSD System

November 15th, 2010 by upa_kid 
Traditionally we used rwall command to send a message to every user on a network. Rwall works over insecure network. Instead of that, we can use wall command over ssh as follows, which is more secure and works with almost all UNIX variant. 1) ssh with wall syntax is as follows, after EOF press enter/return key and type message. When the message is complete, type EOF: $ ssh root@remote-system wall<&ltEOF message1 message2 … … EOF 2)...

FreeBSD > Sending a Message by E-Mail

November 15th, 2010 by upa_kid 
E-mail is a way of sending a message between users and administrators from command prompt for shell script. Use mail command as follows mail -s “Subject” username-name or email-id email message email message … .. When the message is complete, press Control-D or type dot character and press return/enter key. 1) To send email to root user to notify printing problem mail -s “printing...

FreeBSD / Linux: Sending a Message to Windows Workstation with smbclient command

November 15th, 2010 by upa_kid 
<You can use utility smbclient (part of samba server) to send a message to windows system from FreeBSD (or even from Linux/Solaris/UNIX OS). This command lets you send messages to windows workstations, display browse lists, and connect to SMB shares. Genral syntax of to send a message is as follows: smbclient -M <<EOF Message Message … .. … When the...

FreeBSD > Init to reboot or shutdown system

November 15th, 2010 by upa_kid 
FreeBSD init works different ways. In BSD style, it specifies the kernel security level as follows: -1: Permanently insecure mode. 0: Insecure mode 1: Secure mode 2: Highly secure mode 3: Network secure mode You can get current security level (FreeBSD runlevel) using sysctl command: # sysctl –a | grep kern.securelevel You can setup new security level in /etc/rc.conf file: 1) Open file in text editor #...

FreeBSD Display Information About The System Hardware

November 15th, 2010 by upa_kid 
FreeBSD comes with different utilities, which can be use to gathered the information as per your needs. uname command is use to print system information. dmesg command is use to print kernel ring buffer information. sysctl command is use to configure kernel parameters at runtime as well as to read hardware information. Following list summaries, all the command you need to gather FreeBSD hardware information. 1)...

Bash Shell Find out Linux / FreeBSD / UNIX system load average

November 15th, 2010 by upa_kid 
Yes, I know we can use uptime command to find out system load average. If you try to use uptime command in script, you know how difficult it is to get correct load average. As the time since the last, reboot moves from minutes, to hours, and an even day after system rebooted. Just time uptime $ uptime Output: 1:09:01 up 29 min, 1 user, load average: 0.00, 0.00, 0.00 $ uptime Output: 2:13AM up 34 days,...

FreeBSD : How to setup shared directories

November 15th, 2010 by upa_kid 
Recently one of the new admin come across classic problem of “Sharing Directories Among Several User”. I explained him the commands and decided to write this. Although concept is almost same as Linux/UNIX; still people comes across problem. Here is scenario: * /home/project1 : Shared directory * usr1, usr2, … usrN : Would like to work and share files in /home/project1 directory ...

FreeBSD : Job management

November 15th, 2010 by upa_kid 
Most of the new comers in UNIX world aware of ‘How to start a application, job, or even background process from command line’. However shell offers extensive job control like putting a running job in the background, suspend a job, list it, restart it and so on! A) To start a job in background use following syntax: command-name & You would like to start xmms to listen mp3s, you start...

FreeBSD: How to write protect important file ( even root can NOT modify / delete file )

November 15th, 2010 by upa_kid 
The chflags utility modifies the file flags of the listed files as specified by the flags operand. FreeBSD offers write protection, you need to to set special bit call immutable. Once this bit is setup no one can delete or modify file including root. And only root can clear the File immutable bit. You must be a root user to setup or clear the immutable bit. Setup file immutable bit Use chflags command...

FreeBSD: Finding passwordless (no password) account and lock all accounts

November 15th, 2010 by upa_kid 
It is necessary to check for passwordless accounts (i.e. search for no password entries and lock all accounts.) for security reasons. However, FreeBSD does not come with any command that can help you to find out all such accounts. FreeBSD stores password in /etc/master.passwd file. You can use awk to find out all passwordless account. Login in as root user and type following command: awk -F: ‘NF...