Thursday, April 24, 2008

Ubuntu Security and Samba Concerns.


Security

How to Add standard Users
sudo useradd -d /home/ -m

The -d is for creating the Home directory for the user

To Set the password for the new account use this;
sudo passwd

Or if you want to have ubuntu run you through a wizard like process that asks for every piece of information use this:
sudo adduser
[edit]
How to Delete users accounts
sudo userdel

This will however not delete the Home directory. To delete the Home directory just use this:
sudo rm -r /home//
[edit]
How to recover user passwords
sudo apt-get install john
sudo john /etc/shadow
[edit]
How to reset root password

Restart Ubuntu in safe mode and type:
passwd

to change root password.
[edit]
How to create or change GRUB menu password

Visit here.
[edit]
How to change root password if grub password is forgotten

Visit here. To prevent this, you have to set a bios password and set hard disk as the first boot device.
[edit]
How to install TrueCrypt

See TrueCrypt with GUI on Ubuntu 7.10.
[edit]
Servers
[edit]
DHCP Server
[edit]
How to share your internet connection with PCs connected to your server

Read the full article on wiki.steenbe.nl


[edit]
Samba Server
[edit]
How to install Samba Server for files/folders sharing service
Read #General Notes
Read #How to add extra repositories
sudo apt-get install samba smbfs
[edit]
How to add/edit/delete network users
Read #General Notes
Read #How to install Samba Server for files/folders sharing service
To add network user
Read #How to add/edit/delete system users
sudo smbpasswd -a system_username
gksudo gedit /etc/samba/smbusers
Insert the following line into the new file
system_username = "network username"
Save the edited file
To add network user
sudo smbpasswd -a system_username
To delete network user
sudo smbpasswd -x system_username
To enable network user
sudo smbpasswd -e system_username
To disable network user
sudo smbpasswd -d system_username
By Default network users are disabled after adding them, make sure you run the enable network user command above.
[edit]
How to share home folders with read only or read/write permission (Authentication=Yes)
Read #General Notes
Read #How to install Samba Server for files/folders sharing service
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup
gksudo gedit /etc/samba/smb.conf
Find this line
...
; security = user
...
Replace with the following lines
security = user
username map = /etc/samba/smbusers
Remove the ; in front of the following lines (there will text in between explaining what they do):
;[homes]
;comment = Home Directories
;browseable = no
;valid users = %S
;writable = yes
If you want other network users to be able to edit to the folder then change
# By default, the home directories are exported read-only. Change next
# parameter to 'yes' if you want to be able to write to them.
; writable = no
Replace with the following lines
writable = yes
Save the edited file
Read #How to add/edit/delete network users
sudo testparm
sudo /etc/init.d/samba restart
[edit]
How to share group folders with read only permission (Authentication=Yes)
Read #General Notes
Read #How to install Samba Server for files/folders sharing service
sudo mkdir /home/group
sudo chmod 777 /home/group/
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup
gksudo gedit /etc/samba/smb.conf
Find this line
...
; security = user
...
Replace with the following lines
security = user
username map = /etc/samba/smbusers
Append the following lines at the end of file
[Group]
comment = Group Folder
path = /home/group
public = yes
writable = no
valid users = system_username1 system_username2
create mask = 0700
directory mask = 0700
force user = nobody
force group = nogroup
Or if you want other network users to be able to edit to the folder change
writable = yes
Save the edited file
Read #How to add/edit/delete network users
sudo testparm
sudo /etc/init.d/samba restart
[edit]
How to share public folders with read only or read/write permissions (Authentication=Yes)
Read #General Notes
Read #How to install Samba Server for files/folders sharing service
sudo mkdir /home/public
sudo chmod 777 /home/public/
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup
gksudo gedit /etc/samba/smb.conf
Find this line
...
; security = user
...
Replace with the following lines
security = user
username map = /etc/samba/smbusers

Then follow either 1. or 2.
1. Save the edited file.
sudo testparm
sudo /etc/init.d/samba restart
1. Right click the folder and select 'Share folder'. Then change 'Do not share' to share with the network you would like.
1. In Share Properties note the read box. If you want other network users to be able to edit to the folder un-tick this.

OR
2. Append the following lines at the end of file
[public]
comment = Public Folder
path = /home/public
public = yes
writable = yes
create mask = 0777
directory mask = 0777
force user = nobody
force group = nogroup
2. Or if you want other network users to be able to edit to the folder
writable = yes
2. Save the edited file
2. Read #How to add/edit/delete network users
sudo testparm
sudo /etc/init.d/samba restart
[edit]
How to share public folders with read only or read/write permissions (Authentication=No)
Read #General Notes
Read #How to install Samba Server for files/folders sharing service
sudo mkdir /home/public
sudo chmod 777 /home/public/
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup
gksudo gedit /etc/samba/smb.conf
Find this line
...
; security = user
...
Replace with the following line
security = share

Then follow either 1. or 2.
1. Save the edited file.
sudo testparm
sudo /etc/init.d/samba restart
1. Right click the folder and select 'Share folder'. Then change 'Do not share' to share with the network you would like.
1. In Share Properties note the read box. If you want other network users to be able to edit to the folder un-tick this.

OR
2. Append the following lines at the end of /etc/samba/smb.conf (for a read-only folder)
[public]
comment = Public Folder
path = /home/public
public = yes
writable = no
create mask = 0777
directory mask = 0777
force user = nobody
force group = nogroup
2. Or if you want other network users to be able to edit to the folder
writable = yes


2. Save the edited file
sudo testparm
sudo /etc/init.d/samba restart
[edit]
How to print on remote Ubuntu machine via samba
Read #Print Server (cupsd)
Make sure your Ubuntu printers are configured properly.
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.backup
gedit /etc/samba/smb.conf
Find the following lines
...
# printing = cups
# printcap name = cups
...
and uncomment them.
printing = cups
printcap name = cups
Restart cups server
sudo /etc/init.d/cupsys restart
Now printers working on your Ubuntu machine should be acessible via samba.

No comments: