Friday, 24 October 2014

Creating Samba User

Samba User Creation on Samba Server

We can create a user for Samba Server who can own files and directories.

First we create a Linux user who can’t login to any shell.

# useradd -s /bin/false sambauser
# passwd password
Changing password for user sambauser.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

Now we create a samba share directory for the user with owner permissions.

# mkdir /home/samba/sambauserdir
# chown -R sambauser:sambauser /home/samba/sambauserdir

Tuesday, 16 September 2014

Echo Command - Writing Output on Screen

Echo Command

Echo is a shell built-in command used to display a line of text on standard output.

echo with -e option enables interpretation of backslash escapes

Some backslashes used for different purpose are:

alert (BEL)
suppress trailing newline
form feed
new line
carriage return
horizontal tab
vertical tab

Friday, 12 September 2014

Sharing a directory with Samba

Sharing Files and Directories with Samba

Update the global section of configuration file smb.conf as below


workgroup = WORKGROUP

server string = Samba Server

netbios name = LinuxSamba

security = share

Enter the name of workgroup, put server string name as you wish, write the netbios name and security as share.

Thursday, 11 September 2014

Date and hwclock Commands with Example

Date Command

Date command is used to display the current date and time or setting the system date and time on terminal or through ssh session.

date command Examples

To display the current date and time use date command

$ date

Thu Aug 28 17:50:29 IST 2014

To Display The Hardware Clock (RTC), you need to be root user to use hwclock command.

Thursday, 28 August 2014

Linux Command for calculation - bc

bc Command in Linux with Example

bc is a command line basic calculator. bc is typically used as either a mathematical scripting language or as an interactive mathematical shell.

Doing arithmetic calculation use bc as below.

bc can be used with echo command


$ echo "3+5" | bc


$ echo "15-3" | bc