User:Tomato

From ArchWiki
Revision as of 02:10, 27 February 2010 by Tomato (Talk | contribs)

Jump to: navigation, search

just my personal scrapbook

Configure simple file sharing from KDE4 using samba

If you want to easily share files in read only mode go ahead and read this section, if you want to add write functionality too, you must read the section with advanced configuration.

Note: Sadly, simple file sharing functionality is implemented using SUID perl script, and as Archlinux does not support SUID scripts because of security reasons (just like any other recent UNIX like system) nor it has perl-suid package, we will have to get our hands dirty.

Work plan:

  1. install packages
  2. configure samba
  3. modify Template:Codeline scripts
  4. create C wrapper for Template:Codeline to work as a SUID binary
  5. configure KDE side of things
  6. share a folder

Packages we will need:

Installing requisites

Install all packages and their dependencies:

Template:Codeline

Log out and log in again (kdelibs3 are in non standard place and so the PATH must be updated)

Configuring samba

A basic config file works OK, though you'll need to create Samba users (with smbpasswd -a <user name> as root): Template:File

Alternatively you can configure samba with security = share and add guest account = <your user name> to get an anonymous Samba server

Remember to add samba to DAEMONS in /etc/rc.conf if you want it to start at boot time.

Modifying fileshareset scripts

Template:Command

Create C wrapper

Create such files in your home directory:

Template:File

Template:File

compile them using gcc kde4.c -std=c99 -o kde4 and gcc kde3.c -std=c99 -o kde3. Copy them to system folders: Template:Command

Configure KDE

Right click any folder in your home directory and select Properties. Go to Share tab and click 'Configure File Sharing...', you'll be asked for root password. (alternatively run kcmshell4 fileshare as root)

In the dialog you need to select checkbox near "Enable Local Network File Sharing". Check radiobutton besides 'Advanced sharing', unselect NFS sharing, check 'Simple sharing' again.

Click 'Allowed Users' and select the second option -- 'Only users of a certain group are allowed to share folders'. Click 'Choose group...'. Create new group, call it samba-share, don't check and checkboxes in the dialog, click OK. In the new window add yourself to the group and all the other users you may want. Click OK.

Click OK in the main dialog.

Log out, log back in.

Share a folder

When the file sharing is configured you will see a new radio button on the Share tab -- Shared and Not shared. Change position to Shared, click OK. On the shared folder should appear now a small globe to indicate that it is shared.

Configure advanced file sharing in KDE4 using Samba

Work plan:

  1. install packages
  2. configure samba
  3. configure sudo and kdesu
  4. configure KDE side of things
  5. share a folder

Packages we will need:

Installing requisites

Install all packages and their dependencies:

Template:Codeline

Log out and log in again (kdelibs3 are in non standard place and so the PATH must be updated)

Configuring samba

A basic config file works OK, though you'll need to create Samba users (with smbpasswd -a <user name> as root): Template:File

Alternatively you can configure samba with security = share and add guest account = <your user name> to get an anonymous Samba server

Remember to add samba to DAEMONS in /etc/rc.conf if you want it to start at boot time.

Configure sudo

as root run visudo (it uses editor define in $EDITOR or $VISUAL variables) and add line: Template:File this will allow you to run all programs with sudo using your own password.

Run this command to change default super user command: Template:Codeline

Configure KDE

Right click any folder in your home directory and select Properties. Go to Share tab and click 'Configure File Sharing...', you'll be asked for your sudo password. (alternatively run kcmshell4 fileshare as root)

In the dialog you need to select checkbox near "Enable Local Network File Sharing". Check radiobutton besides 'Advanced sharing', unselect NFS sharing.

Click 'Allowed Users' and select the second option -- 'Only users of a certain group are allowed to share folders'. Click 'Choose group...'. Create new group, call it samba-share, don't check and checkboxes in the dialog, click OK. In the new window add yourself, root to the group and all the other users you may want. Click OK.

Click OK in the main dialog.

Log out, log back in.

Share a folder

When the file sharing is configured you will see a new checkbox in the Share tab: 'Share this folder in the local network'. Select checkbox beside 'Share with Samba', give the share some meaningful name and decide whatever it should be writable or not.

More Samba Options list all possible Samba options that can be applied to a share, so it's quite comprehensive.