Archive

Archive for the ‘Linux’ Category

Setup Samba on Ubuntu

September 15, 2011 Leave a comment

1.To install, first open a terminal window and enter the following command:

sudo apt-get install samba smbfs
sudo gedit /etc/samba/smb.conf

2. Find this section in the file:

####### Authentication #######

# “security = user” is always a good idea. This will require a Unix account
# in this server for every user accessing the server. See
# /usr/share/doc/samba-doc/htmldocs/Samba-HOWTO-Collection/ServerType.html
# in the samba-doc package for details.
;  security = user

3. uncomment the “sercurit = user” like this

####### Authentication #######

# “security = user” is always a good idea. This will require a Unix account
# in this server for every user accessing the server. See
# /usr/share/doc/samba-doc/htmldocs/Samba-HOWTO-Collection/ServerType.html
# in the samba-doc package for details.
security = user

5.Lock user in their home directory(You may skip this, if it’s not needed).

[homes]
   comment = Home Directory
   read only = No
   browseable = No
   valid users = %S

6.Add share dictorey(You may skip this, if it’s not needed):

[Shared]
   comment = Global Share - All Users
   path = /samba/shared
   read only = No
   guest ok = Yes
   public = Yes
   browseable = Yes
   create mask = 0666
   directory mask = 0777

7.Create a User for samba(You can skip this step if you already have the user created in linux)

adduser theUserNameYouWant

8.then we need to run the smbpasswd utility to create a samba password for the user.

sudo smbpasswd -a theUserNameYouCreated

9. Restart your samba service by using following command:

sudo /etc/init.d/smb restart

*** For more detailed reference please visit: http://www.brennan.id.au/18-Samba.html

Advertisements
Categories: Linux Tags: ,

Relaying Postfix SMTP via smtp.gmail.com

February 4, 2011 Leave a comment

Install the required packages

sudo aptitude install postfix libsasl2 ca-certificate libsasl2-modules

Configure Postfix

This tutorial will not outline how to configure your postfix server, but we’ll jump directly to the relayhost section.  You’ll want to add the following lines to your /etc/postfix/main.cf file:

relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes

The above lines are telling Postfix that you want to relay mail through gmail on a specific port, telling it to authenticate, and where to find the username and password.  The last three lines specify the authentication types supported, where the certificate authority file is and that it should use tls.

Define Username and Password

Next we’ll need to populate the sasl_passwd file.  Create the file /etc/postfix/sasl_passwd with the following contents:

[smtp.gmail.com]:587    username@gmail.com:password      (If you have customized domain just replace @gmail.com by @yourdomain)

This file should have restrictive permissions and then needs to be translated into a .db that Postfix will read.

sudo chmod 400 /etc/postfix/sasl_passwd
sudo postmap /etc/postfix/sasl_passwd

At this point you can restart Postfix and it should work, however it will complain about not being able to authenticate the certificate.  To take care of this issue we’ll use the ca-certificate package we installed and tell it where it can validate the certificate.

cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem | sudo tee -a /etc/postfix/cacert.pem

Go ahead and reload postfix (sudo /etc/init.d/postfix reload) .

Done!

 

Categories: Linux, Web Dev

Useful commands

August 14, 2010 Leave a comment

extract files:   tar -zxvf

Categories: Linux