Você está na página 1de 9

Filesharing NFS NFS is the default networking protocol for network file sharing in *nix systems (including Ubuntu

Linux). Samba File Sharing Samba client Samba is a networking protocol that allows compatibility with Windows-based networks. The Samba client is installed by default in Ubuntu Jaunty and should work seamlessly (unless you have have a firewall blocking the ports). Samba server The following instructions are to install a Samba server (which is not installed by default). This allows you to share your files over a Samba (Windows) network to other Samba clients.

Install Samba:

sudo apt-get install samba samba-tools system-config-samba smbfs Note: samba-tools, system-config-samba, and smbfs are optional.

Modify Samba settings.

Method 1:

System -> Administration -> Advanced -> Samba (Note: this is available only if you installed system-config-samba.) It is recommended that your user be a member of the sambashare group, as well.

Method 2:

Enable File Sharing Server With User Login (Very Reliable Method) Do the following on the machine that has the files to be shared:

Add current user to Samba:

sudo smbpasswd -a username (replacing username with your login username)

Open the samba config file:

sudo nano /etc/samba/smb.conf

[Pictures]

Add the directories to be added (right at the end) in the following format:

path = /home/username/<folder_to_be_shared> (Replace username with your username and <folder_to_be_shared> with the folder you want to share) Press CTRL+X and then Y to save.

Restart Samba

sudo /etc/init.d/samba restart

On Windows access the folder in the following format in Windows Explorer:

\\192.168.x.x (replace 192.168.x.x with the actual IP address of your server which is serving the folder)

On Linux type the following in Konqueror or Nautilus:

smb://192.168.x.x (replace 192.168.x.x with the actual IP address of your server serving the folder) Note: If you use Sharing in KDE's System Settings panel, be aware that there is a small bug, reported here. In brief, you need to comment out/delete any instances of these two lines in /etc/smb.conf : case sensitive msdfs proxy Change your Workgroup To change your Samba (Windows network) workgroup: sudo nano /etc/samba/smb.conf Look for the line: workgroup = WORKGROUUP and change the setting to whatever your LAN workgroup

Networking Network Manager Network Manager is the default network manager in Ubuntu. It has a tray applet that allows you to switch between Internet connections (such as wireless APs or wired connection). Wicd Network Manager Wicd is a GTK-dependent networking manager written in Python that can be used in all variants of Ubuntu. Some users report it to be faster and more stable than Network Manager. To avoid networking conflicts, Wicd requires the removal of Network Manager prior to installation. sudo apt-get install wicd Set a static IP address I couldn't get Network Manager to accept my static IP address settings manually. Here's the alternative method (which works for wired interfaces only, not wireless):

Remove Network Manager:

sudo apt-get remove network-manager

Edit the /etc/network/interfaces file:

sudo kate /etc/network/interfaces

and replace the line (ok if line is missing)

iface eth0 inet dhcp

with the following lines (using your own LAN settings, of course):

auto eth0 iface eth0 inet static address 192.168.0.35 netmask 255.255.255.0 network 192.168.0.0 broadcast 192.168.0.255 gateway 192.168.0.1

Then restart networking:

sudo /etc/init.d/networking restart

Check to see if your settings are now correct:

ifconfig

If you need a static IP address and have a wireless connection, you have 2 choices:

Install the newer version of Network Manager from the launchpad repository: Add the repository key (you need port 11371 open in your firewall to use the keyserver):

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BC8EBFE8

Add these repositories:

deb http://ppa.launchpad.net/network-manager/ppa/ubuntu karmic main deb-src http://ppa.launchpad.net/network-manager/ppa/ubuntu karmic main

Update

sudo apt-get update or

Uninstall the network manager widget and install wicd

sudo apt-get remove network-manager sudo apt-get install wicd Internet connection sharing (DHCP server) In most LANs, an inexpensive router is used to provide DHCP functions (internet connection sharing). However, DHCP services can also be provided by a single host computer on your LAN if it is directly connected to the Internet. (This is useful, for instance, if you have a 3G or other wireless EVDO connection to your computer which you want to share with the other computers on your LAN). Other client computers on your LAN would then connect to the Internet through your host computer's Internet connection. The host computer now essentially performs the DHCP functions of a router. All "client" computers on the LAN ought to be connected to a central LAN switch or router. (If using a router, it should have its own DHCP functions disabled -- you shouldn't have 2 DHCP servers on a LAN unless you know how to nest LANs). They should all be set up to obtain DHCP-assigned dynamic IP addresses and use the same LAN subnet settings (which in the example below is LAN IP range 10.0.0.1 - 10.0.0.250 with netmask 255.255.255.0 and gateway 10.0.0.1). The host computer to be used as the gateway/DHCP server is then connected (through its own ethernet port) either to one to the ports of the switch (if used), or to

a LAN port of a router (don't use the WAN port). The host computer then connects directly to the Internet (WAN) through a second port (which in the example below will be a wireless (wifi) port (wlan0)). (Note: This setup is easiest if you connect all computers on the LAN with Ethernet cables to the central switch or router. But also see using a nested wireless LAN router below.) (Note: If you want your LAN to use the same subnet as your WAN, see network interface bridging.)

Install the DHCP server and firewall programs:

sudo apt-get install dhcp3-server firestarter

Rename the startup command (through a symbolic link) for the DHCP server. This is required or Firestarter will not know where to find it:

sudo ln -sf /etc/init.d/dhcp3-server /etc/init.d/dhcpd

Edit the DHCP server configuration file:

sudo nano -w /etc/default/dhcp3-server Change the line INTERFACES="" to INTERFACES="eth0"

Restart the DHCP server:

sudo dhcpd restart

Right click on Network-Manager -> Edit Connections... -> Wired -> Add -> Connection name: Shared internet connection -> IPv4 Settings -> Method: Manual -> Add -> Address: 10.0.0.1 -> Netmask: 255.255.255.0 -> Gateway: 0.0.0.0 -> Available to all users: [x]

Attach the ethernet cable to (eth0). Network-Manager -> Wired Networks -> Shared internet connection

Adjust your firewall to allow the internet connection sharing. Start Firestarter:

sudo firestarter

Tell the firewall which port is your direct Internet Connection:

Firestarter -> Preferences -> Firewall -> Network Settings -> Internet connected network device: (wlan0) -> IP address is assigned by DHCP: [x]

Tell the firewall which port is for the LAN, and specify the details for the LAN:

Firestarter -> Preferences -> Firewall -> Network Settings -> Local network connected device: (eth0) -> Enable internet connection sharing: [x] -> Enable DHCP for the local network: [x] -> DHCP server details -> Create new DHCP configuration -> Lowest IP address to assign: 10.0.0.2 -> Highest IP address to assign: 10.0.0.250 -> Name server: <dynamic> Note: Use your own desired LAN settings (internal DHCP-assigned dynamic IP address range), of course. In this example I don't use the full IP range 10.0.0.2 - 10.0.0.255 for dynamic IP addresses because I want to reserve some LAN addresses (10.0.0.251 - 10.0.0.255) to be used as static IP addresses).

Notes:

If you wish to use this setup all the time, make the "Shared internet connection" profile your default connection profile in Network Manager.

Basic Samba set up buntu 9.10 Karmic Koala has come out, and that means its time to explain how to do a basic Samba setup on the new version. All Terminal commands in this walkthrough are bolded, and USERNAME stands for your username on your Ubuntu system. First, youll need to install Samba. Fire up a Terminal window and use this command: sudo apt-get install samba Follow the default prompts to install Samba. Now, Samba uses a separate set of passwords than the standard Linux system accounts (stored in /etc/samba/smbpasswd), so youll need to create a Samba password for yourself with this command: sudo smbpasswd -a USERNAME (USERNAME, of course, is your actual username.) Type a suitably strong password (make sure it includes uppercase, lowercase, punctuation, and numbers). Once your password is created, the next step is to edit your /etc/samba/smb.conf file, the configuration file for Samba. Begin by creating a folder named test on your home folder; well use that for our test shared folder (you can create other shared folders using the same method): mkdir /home/USERNAME/test Next, make a safe backup copy of the original smb.conf file to your home folder, in case you make an error: sudo cp /etc/samba/smb.conf ~ Now use your text editor of choice to edit smb.conf: sudo gedit /etc/samba/smb.conf (New users will probably find gedit the easiest to use due to its GUI; but you can use emacs or vi just as readily, especially if youre using the server version of Ubuntu, which doesnt include X11 by default.) Once smb.conf has loaded, add this to the very end of the file: [test] path = /home/USERNAME/test available = yes valid users = USERNAME read only = no browsable = yes public = yes writable = yes

(There should be no spaces between the lines, and note also that there should be a single space both before and after each of the equal signs.) These settings will share the test folder we created earlier, and give your username and your username alone permission to read and write to the folder. Once you have input the changes, save smb.conf, exit the text editor, and restart Samba with this command: sudo /etc/init.d/samba restart

Once Samba has restarted, use this command to check that your smb.conf doesnt contain any syntax errors: sudo testparm If you pass the testparm command, Samba should be working; try accessing the shared folder from another computer on your LAN.

http://ubuntuforums.org/showthread.php?t=1376506&page=3

sudo ifconfig eth0 mtu 1492 ifconfig | grep MTU

Você também pode gostar