Tuesday, March 24, 2009

Ubuntu - how to set up Samba

1. Install Samba:

root@gamma:~# aptitude install samba
Reading package lists... Done
Building dependency tree... Done
Reading extended state information
Initializing package states... Done
Building tag database... Done
The following packages have been kept back:
akregator apt apt-utils base-files bind9-host bsdutils bzip2 coreutils cpio cupsys cupsys-bsd cupsys-client dbus debconf debconf-i18n dnsutils
dpkg dselect e2fslibs e2fsprogs enscript file firefox gnupg gzip hpijs hplip hplip-data hplip-ppds imagemagick info initramfs-tools iptables
kaddressbook karm kdepim-kio-plugins kdepim-kresources kdepim-wizards klogd kmail kmailcvt knotes kontact korganizer libavahi-client3
libavahi-common-data libavahi-common3 libavahi-qt3-1 libbind9-0 libblkid1 libbz2-1.0 libcomerr2 libcupsimage2 libcupsys2 libcurl3 libcurl3-gnutls
libdbus-1-2 libdbus-glib-1-2 libdbus-qt-1-1c2 libdns21 libexif12 libfreetype6 libgadu3 libgnutls12 libisc11 libisccc0 libisccfg1 libjasper-1.701-1
libkcal2b libkdepim1a libkleopatra1 libkmime2 libkpimexchange1 libkpimidentities1 libkrb53 libksieve0 libktnef1 liblcms1 liblwres9 libmagic1
libmagick9 libmimelib1c2a libmysqlclient15off libnspr4 libnss3 libperl5.8 libpng12-0 libpq4 libruby1.8 libsasl2 libsasl2-modules libsnmp-base
libsnmp9 libss2 libssl0.9.8 libuuid1 libvorbis0a libvorbisenc2 libvorbisfile3 libxine-main1 libxml2 linux-image-2.6.15-26-server
linux-image-server linux-server locales login lvm2 mount mysql-client-5.0 mysql-common mysql-server-5.0 ntpdate openoffice.org openoffice.org-base
openoffice.org-calc openoffice.org-common openoffice.org-core openoffice.org-draw openoffice.org-impress openoffice.org-java-common
openoffice.org-kde openoffice.org-l10n-en-us openoffice.org-math openoffice.org-writer openssh-client openssh-server openssl passwd perl perl-base
perl-modules perl-suid popularity-contest python-crypto python-uno python2.4-crypto python2.4-dbus python2.4-libxml2 rsync ssh sysklogd tar
tcpdump tk8.4 ttf-opensymbol udev util-linux vim vim-common vim-runtime w3m xterm
The following NEW packages will be installed:
samba
0 packages upgraded, 1 newly installed, 0 to remove and 152 not upgraded.
Need to get 2852kB of archives. After unpacking 7262kB will be used.
Writing extended state information... Done
Get:1 http://archive.ubuntu.com dapper-updates/main samba 3.0.22-1ubuntu3.8 [2852kB]
Fetched 2852kB in 2m37s (18.1kB/s)
Preconfiguring packages ...
Selecting previously deselected package samba.
(Reading database ... 67170 files and directories currently installed.)
Unpacking samba (from .../samba_3.0.22-1ubuntu3.8_i386.deb) ...
Setting up samba (3.0.22-1ubuntu3.8) ...
Generating /etc/default/samba...
TDBSAM version too old (0), trying to convert it.
TDBSAM converted successfully.
account_policy_get: tdb_fetch_uint32 failed for field 1 (min password length), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 2 (password history), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 3 (user must logon to change password), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 4 (maximum password age), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 5 (minimum password age), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 6 (lockout duration), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 7 (reset count minutes), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 8 (bad lockout attempt), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 9 (disconnect time), returning 0
account_policy_get: tdb_fetch_uint32 failed for field 10 (refuse machine password change), returning 0
* Starting Samba daemons... [ ok ]
root@gamma:~#


2. Create group samba:
root@gamma:~# groupadd samba

3. Add user my_user_id to group samba:
root@gamma:~# usermod -a -G samba my_user_id

4. Edit the smb.conf file, uncomment what you want to be used:
root@gamma:~# nano /etc/samba/smb.conf

5. Add users who can access samba shares:
root@gamma:/etc/samba# smbpasswd -a my_user_id
New SMB password:
Retype new SMB password:
root@gamma:/etc/samba#

6. If you need to make more changes to your smb.conf, restart samba after you're done:
root@gamma:/etc/samba# /etc/init.d/samba restart

No comments:

Post a Comment