On this page... (hide)
- 1. Install a specific package version
- 2. Trouble with cron jobs as non root user
- 3. Unblocking a package
- 4. Removing dependencies manually from portage cache.
- 5. Moving windows in Gnome and KDE
- 6. Static IP using
ifconfigandroute - 7. Video Screen Capture (
xvidcap) - 8. Stopping the X server
- 9. Dual display --- nVidia --- S-Video out
- 10. ALSA
- 11. Get to a command line from say Gnome or X
- 12. Adding users to the
/etc/groupfile - 13. How to install Xmoto
- 14. esearch for indexed emerge searches
- 15. install a package
- 16. uninstall a package
- 17. making sure you can 'su'
- 18. setting up a printer
- 19. file that lists installed packages
- 20. mounting a usb flash drive
- 21. printing with gimp
- 22. if a program fails to install, something about checksum
- 23. Installing fonts
- 24. Setting Java Class Path's
- 25. Masked packages (read the for sure part below)
- 26. pop3 server
- 27. University of Washington imap and pop3 servers
- 28. static ip
- 29.
eximmail server - 30. Change X screen resolution and other monitor settings.
- 31. Mounting a cdrom or dvdrom
- 32. Configuring ProFTPd
- 33. Export an X session
- 34. mod_ftpd for apache
- 35. pure-ftpd with mysql auth
- 36. Samba Server
- 37. xscreensaver
- 38. ssh_exchange_identification: Connection closed by remote host
- 39. Installing VLC
- 40. Postfix
- 41. My Pine Setup Using Postfix and IMAP
- 42. VNC Server (
tightvnc) - 43. DHCP server
- 44. Add a program to the default run time or bootup.
- 45. Page Comments (Click to edit)
1. Install a specific package version
Say you want to install xmoto-0.4.1. If you just do emerge xmoto you may get version 0.3.4 or something like that. Here's the command you want.
# emerge =xmoto-0.4.1
Say you're not sure, but you want at least a version higher than 0.3.4, then issue this command.
# emerge '>=xmoto-0.3.5'
Basically, all packages have the same syntax package_name-version_number.
1.1 Install exact package version
# emerge =package-version
1.2 Install package version that's greater than or equal to a specified version
I believe this works with <, > and <= as well as shown below >=.
# emerge '>=package-version'
2. Trouble with cron jobs as non root user
Don't worry about it, just see if /var/spool/cron exists and if not create it. Then change the permissions to cron:root and 755 for the directory.
Then check for a dir /var/spool/cron/crontabs and if it does not exist create it with permissions root:crontab and 1730 (yes 1730 not 730)
Last check for directory /var/spool/lastrun with permissions root:root and 750
3. Unblocking a package
Why are some packages blocked?
Most packages are blocked because of one of 3 reasons.:
- The KEYWORD variable in all available ebuilds for that package is missing or set testing(~) for your arch type.
- The package is hard masked in
/usr/portage/profiles/package.mask - The package is blocked by another package that is installed.
Unblocking KEYWORD masked packages
For keyword masked files you only need to add a CPV dep entry in /etc/portage/package.keywords or if its missing, copy the ebuild and needed files into your overlay and edit the KEYWORD value.
File: /etc/portage/package.keywords
>=net-misc/curl-7.11.0 ~x86
To unmask a package once only set ACCEPT_KEYWORDS prior to running emerge. e.g.
ACCEPT_KEYWORDS="~x86" emerge vmware-server
This is particularly useful when combined with -p pretend flag as it allows you to see everything required in the emerge without needing to modify the files mentioned above.
Unblocking hard masked packages
To unmask hard masked packages just add its CPV dep string to /etc/portage/package.unmask
File: /etc/portage/package.unmask
net-im/skype
Unblocking packages by removing a blocking package
The workaround is to remove the old package and emerge the new package. The goal is to do it safely.
emerge --buildpkgonly --nodeps BLOCKEDPACKAGE && emerge -C BLOCKINGPACKAGE && emerge --usepkgonly BLOCKEDPACKAGE
- Build new, blocked package first using
--buildpkgonly --nodeps. - Only if that was successful do we unmerge the old, blocking package.
- Finally we install the new package with
--usepkgonly
File: unblock.sh
#!/bin/bash BLOCKER=$1 BLOCKED=$2 if [[ "$BLOCKED" == "" ]]; then echo "unblock <blocker> <blocked>" exit; fi emerge --buildpkgonly --nodeps $BLOCKED && emerge -C $BLOCKER && emerge --usepkgonly $BLOCKED
http://gentoo-wiki.com/FAQ_Blocked_Package »
4. Removing dependencies manually from portage cache.
First, the portage cache is located in /var/cache/edb. I was trying to install gnome once and orca would not install. It said I needed a certain module compiled into python. Anyway, I just went into that directory /var/cache/edb/dep/usr/portage/app-accessibility and removed the entry I needed from the RDEPEND and DEPEND variable.
This may not be the best thing to do, but it was my only option at the time and may be of use to someone else.
5. Moving windows in Gnome and KDE
SORRY: I know this isn't Gentoo specific.
If you hold down Alt, you can then click anywhere on the window to drag it.
Thanks Simon and Matt of BLUG ».
6. Static IP using ifconfig and route
192.168.1.2 is the IP address of my computer. 192.168.1.1 is the IP address of my router.
# ifconfig eth0 192.168.1.2 broadcast 192.168.1.255 netmask 255.255.255.0 up # route add default gw 192.168.1.1
You will also have to edit /etc/resolv.conf and enter your name servers. You can either look up some public name servers or use those provided by your ISP.
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=3 »
7. Video Screen Capture (xvidcap)
If you would like to record a video of your screen, you can use xvidcap.
# emerge xvidcap
From the command line, just run xvidcap and select an area to record, and hit the big RED record button.
8. Stopping the X server
In gnome, I had to stop the X server once to install the nvidia drivers. So here's the best way to do it.
While in gnome, hit the key combination ctrl + alt + F1 and that will take you into text mode, then login if you have to and,
# /etc/init.d/xdm stop
Do whatever work you need to do here and then,
# /etc/init.d/xdm start
This should take you back to the gnome login screen.
9. Dual display --- nVidia --- S-Video out
I'm not sure if this makes since, but once when I installed Gentoo with nVidia drivers, it wasn't setup for S-Video out to a TV after emerging the nvidia drivers, but the last time I installed it, the S-Video out was working right away. A couple differences were: I installed gnome instead of only fluxbox, and also the S-video cable was plugged into my card and the TV. Whatever it was, under Applications > System Tools was the nVidia X Server Settings tool. In there you can setup the S-Video out.
10. ALSA
Alsa by default comes muted. You must install alsa-utils and then run the command
# alsamixer
to unmute and test your sound.
Also, you can run
cat /proc/asound/cards
to make sure you have your sound card modules installed.
11. Get to a command line from say Gnome or X
Hit the key combination ctrl+alt+F1
12. Adding users to the /etc/group file
Open /etc/group and add the users separated by columns to the end of each group line or
gpasswd -a <username> <group>
13. How to install Xmoto
# ACCEPT_KEYWORDS="~x86" emerge -ak '>=xmoto-0.2.7'
At the time of this example, the only stable version was 0.2.0 so I used this command to install a masked package of a newer version.
14. esearch for indexed emerge searches
# emerge -pv esearch
The usage for this is just like with emerge --search search_term, but I make an alias alias es="esearch" so that I can search with es search_term. Just like with locate and running updatedb you have to run eupdatedb. If you run esync it will show you the new packages that will be added to the index. (I'm not a 100% sure on that though -- that's just from reading the man pages briefly. man esync).
15. install a package
# emerge <package name>
also
# emerge <package type>/<package name>
you can view all packages in /usr/portage e.g. # emerge www-client/mozilla-firefox it will automatically download the newest version, although i think you can set it up to download/compile a certain version.
16. uninstall a package
You will be given 5 seconds to change your mind.
# emerge unmerge <package name>
17. making sure you can 'su'
after useradd username, make sure you add that user to the group wheel you can do that from useradd or directory in /etc/group, just add your username to the end of the group you want in /etc/group.
18. setting up a printer
I used cups. start cupsd /etc/init.d/cupsd start then open a webbrowser and go to localhost:631 if that's the port you set. This can all be done in /etc/cups conf files.
I set up an ip printer. Say it's IP was 1.2.3.4 I added it as an ipp printer with the address ipp://1.2.3.4/ipp/ and everything went fine. You may have to edit the file below.
Edit /etc/cups/mime.convs and uncomment
application/octet-stream application/vnd.cups-raw 0 -
19. file that lists installed packages
/var/lib/portage/world
20. mounting a usb flash drive
To find out what usb devices you have available, issue the command
# ls -l /dev/disk/by-id/usb*
if you know where the flash drive is, in this example /dev/sda1 which you can locate probably in /var/log/ messages or by doing
# hdparm /dev/sda
or
# cat /proc/bus/usb/devices
then you can just
# cd /mnt # mkdir flashdrive # mount -t vfat /dev/sda1 flashdrive
and it should be mounted, assuming it is formatted in vfat. if not substitute the type there. or you can leave out the -t vfat and you will get an 8.3 format. :(
With my MPIO I only had to do
# mount -t vfat /dev/sda flashdrive
With a card reader of mine I used
# mount -t vfat /dev/sda1 usb
In general you can add these lines to your /etc/fstab file
/dev/cdroms/cdrom0 /mnt/cdrom iso9660 noauto,ro 0 0 /dev/fd0 /mnt/floppy auto noauto 0 0 /dev/sda1 /mnt/usb auto noauto 0 0
and then if you want to mount your cdrom all you have to do is type
# mount /dev/cdroms/cdrom0
or
# mount /dev/sda1
to mount a usb device -- in this case a card reader.
http://gentoo-wiki.com/HOWTO_gnome-volume-manager » http://gentoo-wiki.com/HOWTO_USB_Mass_Storage_Device »
21. printing with gimp
note, you must
# emerge gimpprint
or
# emerge gimp-print
when you 'emerge gimp' make sure /etc/make.conf has USE="gimpprint" enabled.
checking use variables (configuration)
# emerge -pv program
this will tell you what use variables are enabled/disabled
22. if a program fails to install, something about checksum
I found out that this is because when you 'emerge' a program, it goes to /usr/portage/distfiles, so, if you re-emerge something and it doesn't work, you should delete the one in /usr/portage/distfiles, so that the checksum doesn't conflict.
23. Installing fonts
The base directory is /usr/share/fonts
I used fontforge to create a font, and generated the font in Type 1 format (.pfb). I then saved the font to /usr/share/fonts/freefonts
24. Setting Java Class Path's
Create a file called
package.env
in an appropriate directory for the application you want setup.
In package.env, add
DESCRIPTION= CLASSPATH= DEPEND=
and whatever else you need.
Then run
(Don't type /package.env, just the path up to it. no trailing slash.)
# java-config --set-system-classpath=/path/to/dir/containing/package.env
Then run
# env-update && source /etc/profile
25. Masked packages (read the for sure part below)
Sometimes when you try to emerge a program, emerge will tell you the package has been masked. I'm not exactly sure how to force these programs, but someone told me that you have to open the actually .ebuild and remove the tilde(~) from something. Possibly from in front of you architecture. e.g. ~x86
I found more on masking at gentoo-wiki.org?.
Getting the latest drivers will probably mean unmasking them.
echo "media-video/ati-drivers ~arch" >> /etc/portage/package.keywords echo "media-video/ati-drivers-extra ~arch" >> /etc/portage/package.keywords
Replace <~arch> with your system architecture; it's going to be either ~x86 or ~amd64, the only two CPU architectures supported by the ATI driver.
A sure way to make masked packages to install
Instead of running the command
emerge [program]
run
ACCEPT_KEYWORDS="~x86" emerge -va [program]
You can also add ACCEPT_KEYWORDS="~x86" to your /etc/make.conf file to always allow masked packages.
Actually, probably the best thing to use is cd into the directory of the portage. So for like emerge -ak mol you can go into /usr/portage/app-emulation/mol and read the .ebuild file for the KEYWORDS varible.
ACCEPT_KEYWORDS="what ever was in the KEYWORDS variable" emerge -ak [program]
A for sure way to unmask a package is
echo "app-emulation/mol -* ~*" >> /etc/portage/package.keywords
26. pop3 server
# emerge vm-pop3d
To start the start issue:
# /etc/init.d/vm-pop3d start
27. University of Washington imap and pop3 servers
# emerge uw-imap
It will put files in /etc/xinetd.d. The executables are installed in /usr/sbin.
28. static ip
added
config_eth0=( "192.168.1.69 netmask 255.255.255.0 broadcast 192.168.1.255" ) routes_eth0=( "default gw 192.168.1.1" )
in /etc/conf.d/net
added
nameserver 64.240.76.4 nameserver 204.127.198.4
in /etc/resolv.conf as my dns servers.
You will then want to restart net.eth0 or what ever your network is set up for.
# /etc/init.d/net.eth0 restart
29. exim mail server
# emerge exim
In /etc/exim there should be a file exim.conf.dist. Copy this file to /etc/exim/exim.conf. I have my mail server setup on a home computer with a domain say www.domain.com and my router has an IP range of say 192.168.0.1 to 192.168.0.255. My mail directory is setup to be /var/mail or /var/spool/mail -- one is a symbolic link. If your username is foobar you will have to create a mail box if it doesn't exist and make sure you are a member of the group wheel.
# cd /var/spool/mail # touch foobar # chown foobar:wheel foobar
Edit /etc/group and at the end of the group wheel add your user name like:
wheel::10:root,foobar
Change the following lines in exim.conf.
domainlist local_domains = @
to
domainlist local_domains = @:domain.com
hostlist relay_from_hosts = 127.0.0.1
to
hostlist relay_from_hosts = 127.0.0.1:192.168.0.1/255
# file = /var/mail/$local_part directory = /home/$local_part/.maildir
to
file = /var/mail/$local_part # directory = /home/$local_part/.maildir
If you don't make the last change, each email will be stored as a seperate file in /home/yourusername/.maildir/new or cur ... etc.
Start exim with
# /etc/init.d/exim start
One thing to note is that if you are using procmail with a .forward file, exim currently doesn't support the "\|IFS=' '. I've read that you should use /bin/sh -c "\|IFS=' ' but I haven't got that to work yet.
To allow exim style filtering uncomment the line in /etc/exim/exim.conf
#allow_filter
30. Change X screen resolution and other monitor settings.
Use xrandr in a terminal.
Use
# xrandr -s 1024x768
for example, to change your resolution.
31. Mounting a cdrom or dvdrom
I have a cdrom and a dvdrom in my system. I saw in /dev/cdroms a cdrom1 and a cdrom2. In my /etc/fstab I had
/dev/cdroms/cdrom0 /mnt/cdrom iso9660 noauto,ro 0 0
so I made a directory in /mnt called /mnt/dvdrom and added
/dev/cdroms/cdrom1 /mnt/dvdrom iso9660 noauto,ro 0 0
to my /etc/fstab file. I then did a
# mount /dev/cdroms/cdrom1
You should be able to access your dvdrom or whatever your mount in /mnt/cdrom or /mnt/dvdrom whichever.
32. Configuring ProFTPd
http://gentoo-wiki.com/HOWTO_setup_a_home-server#Configuring_ProFTPd »
33. Export an X session
This week's tip shows you how to run GUI programs remotely by exporting an X session and tunneling it over SSH. Note that this is heavily dependant on the speed of your network connection. If you're trying to run Mozilla off of a box on the other side of the country on a 56K modem it is probably not going to work very well. The best application for this is running programs over the same LAN or possibly a high-speed WAN. An easy example application is running gvim remotely so you can have a GUI editor.
For this example we assume the local machine has an IP of 192.168.1.2 and the remote machine has an IP of 192.168.1.3. On the local machine you're going to need to give the remote machine access to connect to your X server. Use the command xhost to do this.
Code Listing 9.1: Local machine
(This command allows the machine with the IP 192.168.1.3 to connect)
# xhost +192.168.1.3
On the remote machine, you need to export the $DISPLAY variable to your local machine. After that, you should be ready to run GUI programs remotely.
Code Listing 9.2: Remote machine
# export DISPLAY="192.168.1.2:0.0" # gvim /etc/passwd
(You should see gvim open on your local machine with the contents)
(of the remote machine's /etc/passwd file.)
Note: This is very unsecure and not recommended since everything you type including passwords will be transmitted over the network unencrypted.
To tunnel the connection over SSH and thus encrypt the traffic edit your /etc/sshd2_config file.
Code Listing 9.3: /etc/sshd2_config
(Add or edit the following line)
ForwardX11 yes
Now connect from the local machine to the remote machine via ssh and start your X application.
Code Listing 9.4: Remote machine
# gvim /etc/passwd
(You should see gvim open on your local machine with the contents)
(of the remote machine's /etc/passwd file.)
Notice that you don't have to set the DISPLAY variable, ssh automagically does that for you. You do however have to allow access to your local machine's X server (see above).
http://www.gentoo.org/news/en/gwn/20030602-newsletter.xml »
34. mod_ftpd for apache
http://gentoo-wiki.com/Apache_Modules_mod_ftpd »
35. pure-ftpd with mysql auth
Requirements
1. Running Webserver with PHP Support 2. A Running PureFTP Daemon with MySQL Auth support 3. MySQL 4. PhpMyAdmin
Instruction
USE="mysql" emerge -av pure-ftpd
Edit /etc/conf.d/pure-ftpd, and edit the auth method to this:
File: /etc/conf.d/pure-ftpd
AUTH="-l mysql:/etc/pureftpd-mysql.conf"
Note: if you want to use unix and puredb method, just add them in the same line
AUTH="-l unix -l puredb:/etc/myfile.db -l mysql:/etc/pureftpd-mysql.conf"
In order to get pureftpd to start, you have to uncomment out this line of code in /etc/conf.d/pure-ftpd:
File: /etc/conf.d/pure-ftpd
IS_CONFIGURED="yes"
Now create the /etc/pureftpd-mysql.conf with the follwing: Note: the password should be the same as mysql userpassword from your MySQL database configuration (See below).
File: /etc/pureftpd-mysql.conf
MYSQLSocket /var/run/mysqld/mysqld.sock #MYSQLServer localhost #MYSQLPort 3306 MYSQLUser pureftpd MYSQLPassword ftpdpass MYSQLDatabase pureftpd #MYSQLCrypt md5, cleartext, crypt() or password() - md5 is VERY RECOMENDABLE uppon cleartext MYSQLCrypt cleartext MYSQLGetPW SELECT Password FROM ftpd WHERE User="L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "R") MYSQLGetUID SELECT Uid FROM ftpd WHERE User="L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "R") MYSQLGetGID SELECT Gid FROM ftpd WHERE User="L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "R") MYSQLGetDir SELECT Dir FROM ftpd WHERE User="L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "R") MySQLGetBandwidthUL SELECT ULBandwidth FROM ftpd WHERE User="L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "R") MySQLGetBandwidthDL SELECT DLBandwidth FROM ftpd WHERE User="L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "R") MySQLGetQTASZ SELECT QuotaSize FROM ftpd WHERE User="L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "R") MySQLGetQTAFS SELECT QuotaFiles FROM ftpd WHERE User="L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "R")
Note: if you want to use network instead of local socket, just comment the socket part and uncomment the host and port
Now create a pureftp database: Code:
user@host $ mysql -u root -p
password:
mysql> CREATE DATABASE pureftpd;
mysql> USE pureftpd;
mysql> CREATE TABLE ftpd (
User varchar(16) NOT NULL default '',
status enum('0','1') NOT NULL default '0',
Password varchar(64) NOT NULL default '',
Uid varchar(11) NOT NULL default '-1',
Gid varchar(11) NOT NULL default '-1',
Dir varchar(128) NOT NULL default '',
ULBandwidth smallint(5) NOT NULL default '0',
DLBandwidth smallint(5) NOT NULL default '0',
comment tinytext NOT NULL,
ipaccess varchar(15) NOT NULL default '*',
QuotaSize smallint(5) NOT NULL default '0',
QuotaFiles int(11) NOT NULL default 0,
PRIMARY KEY (User),
UNIQUE KEY User (User)
) TYPE=MyISAM;
mysql> grant SELECT, INSERT, UPDATE, DELETE, CREATE, DROP on pureftpd.* to pureftpd@localhost identified by 'ftpdpass';
mysql> flush privileges;
mysql> exit
Restart Pure-ftpd
/etc/init.d/pure-ftpd restart
Now you can access Phpmyadmin and admin, the ftp users via the web
Note: You have to set the Uid and Gid in you mysql database to the actual ids for your ftp user from the password and group file.
http://gentoo-wiki.com/HOWTO_PureFTPD_with_MySQL_Auth_and_PhpMyAdmin »
ftpd Table:
- User: The name of the virtual PureFTPd user (e.g. exampleuser).
- status: 0 or 1. 0 means the account is disabled, the user cannot login.
- Password: The password of the virtual user. Make sure you use MySQL's MD5 function to save the password encrypted as an MD5 string:
- UID: The userid of the ftp user you created at the end of step two (e.g. 2001).
- GID: The groupid of the ftp group you created at the end of step two (e.g. 2001).
- Dir: The home directory of the virtual Proftpd user (e.g. /home/www.example.com). If it does not exist, it will be created when the new user logs in the first time via FTP. The virtual user will be jailed into this home directory, i.e., he cannot access other directories outside his home directory.
- ULBandwidth: Upload bandwidth of the virtual user in KB/sec. (kilobytes per second). 0 means unlimited.
- DLBandwidth: Download bandwidth of the virtual user in KB/sec. (kilobytes per second). 0 means unlimited.
- comment: You can enter any comment here (e.g. for your internal administration) here. Normally you leave this field empty.
- ipaccess: Enter IP addresses here that are allowed to connect to this FTP account. * means any IP address is allowed to connect.
- QuotaSize: Storage space in MB (not KB, as in ULBandwidth and DLBandwidth!) the virtual user is allowed to use on the FTP server. 0 means unlimited.
- QuotaFiles: amount of files the virtual user is allowed to save on the FTP server. 0 means unlimited.
Here is my sample database entry
mysql> select * from ftpd;' +-------+--------+-------------+-----+-----+-----------+-------------+-------------+---------+----------+-----------+------------+ | User | status | Password | Uid | Gid | Dir | ULBandwidth | DLBandwidth | comment | ipaccess | QuotaSize | QuotaFiles | +-------+--------+-------------+-----+-----+-----------+-------------+-------------+---------+----------+-----------+------------+ | bob | 1 | bobspass | 1004 | 407 | /home/ftp | 0 | 0 | | * | 0 | 0 | | joe | 1 | joespass | 1004 | 407 | /home/ftp | 0 | 15 | | * | 0 | 0 | +-------+--------+-------------+-----+-----+-----------+-------------+-------------+---------+----------+-----------+------------+
Here are the permissions for my ftp directories
# ls -l /home dr-x------ 5 ftp ftp 4096 Jan 21 21:10 ftp # ls -l /home/ftp total 12 dr-x------ 2 ftp ftp 4096 Feb 15 10:44 software drwx------ 2 ftp ftp 4096 Feb 6 10:34 upload dr-x------ 2 ftp ftp 4096 Feb 7 11:03 video
Notice that the software and video directories don't have w (write) permissions meaning you can only download from these directories whereas the upload directory has write permission so you can upload files here.
http://www.howtoforge.com/pureftpd_mysql_virtual_hosting_p3 »
36. Samba Server
Configuration
Configuration file for Samba server is /etc/samba/smb.conf Open it with your favorite text editor and let's edit. In the beginning of file (in global section) you'll see following: Code: smb.conf file
[global] # workgroup = NT-Domain-Name or Workgroup-Name, eg: LINUX2 workgroup = WORKGROUP netbios name = LINUXBOX # server string is the equivalent of the NT Description field server string = Lets dance samba # Security mode. Defines in which mode Samba will operate. Possible # values are share, user, server, domain and ads. Most people will want # user level security. See the HOWTO Collection for details. security = share
"Netbios name" is your computer name (usually same as your hostname). "Workgroup" is your workgroup (how strange, isn't it? :)). "Server string" is description of the samba server. Make security = share if you want to share files without password. Easy for making anonymous access.
- Requiring Authentication For Your Samba Shares
If you are interested in requiring your remote users to log into the share and protecting it with a password, you should set an alias for guest. This is because Windows (XP Pro in my case at least) uses the username "Guest" as the default login with the share security level. Do this as follows:
guest account = local_user
The problem is that this will only work for authenticating 1 user. In my case, I only have 1 local account on my samba server, so it works for me. Hopefully someone will come along to edit this to allow for different user logins per share.
Make a particular directory for samba log files. And set maximum log size, because we don't want to be flooded with huge logs.
log file = /var/log/smb/samba.%m max log size = 50
Now proceed in the file and find this part:
# Browser Control Options: # set local master to no if you don't want Samba to become a master # browser on your network. Otherwise the normal election rules apply # local master = yes
If you don't want windows users to blame you, change option local master to "no" and uncomment the line. With this option = yes your linux box and windows hosts will argue about local master browser rights on your LAN. Make this change:
local master = no
If you'd like to share your printers over samba (assuming your printers are running under a cups server), you need to add the following lines somewhere in the global section:
#added for remote printer use over samba printcap name = cups disable spoolss = Yes show add printer wizard = No printing = cups
This will require that the remote machines install the drivers for the printer locally. In the case of Windows machines, you will need to install the drivers first and then connect to the share over the network.
We're finished with global section of smb.conf file. Now proceed in the next chapter to see how to share directories. --Skeezer65134 12:07am, 27 June 2005 (CST)
Adding a Share
Sharing on Linux is simple as on Windows box. Just go to end of smb.conf file and add this:
Sharing directories with Samba
[public]
comment = shared
path = /mnt/public
guest ok = yes
browseable = yes
Make neccessary changes, where "comment" is your share comment, "path" is your shared directory path and "public" is your shared directory name. This will allow users on your network to connect to this share with access rights of user nobody.
If you are interested in using user authentication, you need to specify what users may access this share. Change the above to look like this:
Sharing directories with user access control with Samba
[public]
comment = shared
path = /mnt/public
valid users = local_user
guest ok = no
browseable = yes
This will allow a remote machine to connect to the samba share by logging in as local_user and entering the correct password. Note that we use the 'guest account = local_user' above in the global configuration. Again, Windows will default to logging in as Guest, and you will not be able to chage this, so the above makes a nice work-around.
If you want to give write permissions to your samba users, just add writable = yes, as follows (make sure that permissions in those directories you are offering are right. If not, use chmod, of course):
[public]
comment = shared
path = /mnt/public
valid users = local_user
guest ok = no
browseable = yes
writable = yes
To add all local printers that connect via the CUPS server, add something like this:
[printers]
comment = All Printers
path = /var/spool/samba
printer admin = root, local_user
create mask = 0600
guest ok = Yes
printable = Yes
use client driver = Yes
browseable = No
This will list ALL of your local CUPS printers and list them based on their names and descriptions as defined in the CUPS configuration. Once again, the local machine connecting to the printer over samba will need to install the drivers first for it to work.
Don't forget you need to start your Samba server before you can set the user's Samba password. Code: Starting Samba
#/etc/init.d/samba start * Caching service dependencies ... [ ok ] * samba -> start: smbd ... [ ok ] * samba -> start: nmbd ... [ ok ]
Adding a Valid User
For user access control, please note that you MUST specify a password for local_user using smbpasswd. The reason being that the user must also exist in /etc/samba/smbusers AND be a valid user on the computer running the samba server for Samba to have enough information to go through with authentication.
Setting samba user passwords
#smbpasswd -a local_user New SMB password: <type password> Reenter smb password: <type password again> Added user local_user.
/etc/samba/smbusers
local_user = local_user
Note that the second name you enter can be a separate alias for local_user to log in to the samba share. More clearly, the name to the right of the = can be anything and will be used to log into the samba share. This must match the "valid user" statement in the share's definition.
Starting Samba on Boot
Adding Samba to default runlevel
rc-update add samba default
http://gentoo-wiki.com/HOWTO_Setup_Samba »
37. xscreensaver
If you emerge xscreensaver, you must start the daemon. I'm not sure how to start it directly, but if you run xscreensaver-demo from a shell, it will prompt you to start the daemon.
38. ssh_exchange_identification: Connection closed by remote host
If you get this message when trying to ssh into your machine you can still get in. Two ways, if you are not close to your machine but are remote and you installed webmin, you may be able to get in. Just got to Others and then command shell. You should change the permissions of the files in /etc/ssh. The best thing to do is,
# chmod 644 /etc/ssh/* # chmod 600 /etc/ssh/*key
This should work and you can ssh in again. If you are remote and don't have webmin, you will have to wait until you get to a local terminal. :(
39. Installing VLC
See the USE variables at page:Gentoo Install Notes?.
Install VLC with:
# emerge -av vlc
If a package is masked you may have to use
# ACCEPT_KEYWORDS="~x86" emerge -av vlc
40. Postfix
# emerge postfix
You can then start postfix with
# /etc/init.d/postfix start
or substitute start with restart, reload or stop along with other commands.
If you would like to have an email address such as myusername@mail.yourdomain.com you should setup your server as follows. You must set with your DNS providers the host mail.yourdomain.com to point to the IP of your computer. Then, in /etc/postfix/main.cf you should set mydestination to at least mydestination = localhost, mail.yourdomain.com or if you set mydomain = yourdomain.com then you would use mydestination = localhost, mail.$mydomain which should be the standard way. Then just do a /etc/init.d/postfix reload and your ready to go.
If you want to allow relay access for certain computer you can do this by style or IP ranges. You can use mynetworks_style = host to only allow relay from the localhost. If you want to allow relay for a certain IP use mynetworks = 12.34.12.34. There's more examples in your /etc/postfix/main.cf. You can then do a postfix reload to take the new configuration.
41. My Pine Setup Using Postfix and IMAP
To access my mail box using my courier IMAP setup I use the line
inbox-path={www.mydomain.com/imap/novalidate-cert}INBOX
or the unsecure version
inbox-path={www.mydomain.com/imap/notls}INBOX
42. VNC Server (tightvnc)
Install tightvnc
# emerge tightvnc
Setup a password. Login as root.
# cd /root # mkdir .vnc # cd .vnc # vncpasswd passwd
Enter your password and then execute
# vncserver
Your server should be up and running and you should be able to connect to your vncserver I think on port 5991 with host something like my.ip.address:0.
43. DHCP server
# emerge dhcp
Edit /etc/dhcp/dhcpd.conf
# emerge dhcp
Configuration
A freshly emerged dhcp will contain a sample configuration file (/etc/dhcp/dhcpd.conf.sample). This file can be copied to /etc/dhcp/dhcpd.conf and used as the basis of the configuration.
The example shown below is typical for a small network. It contains a definition for the subnet, plus the hosts you want to assign a specific details such as IP address.
File: /etc/dhcp/dhcpd.conf
# dhcp.conf
# Sample DHCP Server Configuration File
# option definitions common to all supported networks...
option domain-name "internal";
option domain-name-servers 192.168.2.1, 192.168.2.130;
option routers 192.168.2.1;
ddns-update-style none;
default-lease-time 600;
max-lease-time 7200;
subnet 192.168.2.0 netmask 255.255.255.0 {
range 192.168.2.100 192.168.2.128;
}
# example for a address that will bee given to a fixed hardware (mac)
host laptop {
hardware ethernet 00:10:5a:2e:56:a7;
fixed-address 192.168.2.4;
option routers 192.168.2.1;
option broadcast-address 192.168.2.255;
}
This configuration file is described below:
- domain-name
Global organisation-wide domain name.
- domain-name-servers
Global organisation-wide domain name servers, comma separated.
- routers
The default gateway address.
* ddns-update-style
none: This tells the dhcp server not to update dns
* hardware ethernet
The MAC address of the clients NIC.
- authoritative
A DHCP server can actually run with other DHCP servers on the subnet. But if you want this one to be the one that everyone should look for in case of address collisions, then add authoritative to part of your config file, preferably the first line.
- allow booting and allow bootp
If setting up your DHCP server to accept DHCP requests for clients booting over the network, add those two entries somewhere (one per line) to your config. Likely you'll need more than just those.
- option log-servers <ip-address>
If you want your DHCP server to send messages to a system logger other than the local machine, use this setting here. You'll have to setup your system logger (running on the ip address specified) to listen to remote logging.
For lots more options and explanations, see man dhcpd.conf
http://gentoo-wiki.com/HOWTO_setup_DHCP »
44. Add a program to the default run time or bootup.
If you have a program (daemon) such as sshd that you would like to be started at bootup time, issue the command
# rc-update add sshd default
Any of the scripts in /etc/init.d can be done this way as far as I know. Correct me if I'm wrong.
X11 no keyboard or mouse ABI warnings
After trying to start X with startx I was getting these errors,
(EE) module ABI minor version (6) is newer than the server's version (5) (EE) Failed to load module "mouse" (module requirement mismatch, 0) (EE) module ABI minor version (6) is newer than the server's version (5) (EE) Failed to load module "kbd" (module requirement mismatch, 0) (EE) No drivers available.
If you ever get these, you can run
emerge xf86-input-mouse xf86-input-keyboard
or
emerge xf86-video-nv
if you're also getting the error
(EE) module ABI major version (1) doesn't match the server's version (0) (EE) Failed to load module "nv" (module requirement mismatch, 0)
Installing different versions of ebuilds
I'll use the game nexuiz as an example. I ran emerge nexuiz and it installed version 1.5. After looking in /usr/portages/games-fps/nexuiz I saw that there was a version 1.5 and a version 2.0. So to get the 2.0 to install you can run
# emerge '>=nexuiz-2.0'
which will install anything greater than or equal to version 2.0. When I ran this, of course it was masked so I had to run
# ACCEPT_KEYWORDS="~x86" emerge '>=nexuiz-2.0'
SSH mounting of directories
When I want to mount another directory from a machine that has an SSH server, I don't use samba or nfs or something like that -- I use shfsmount.
The first thing you will want to do is
# emerge shfs
and then, you will have shfsmount. From there, say you have a machine at 192.168.0.101 with a directory /home/joe/storage that you want to mount on your gentoo machine. Actually, shfsmount works on other distros. I'm just using this one as an example. So here is the command if say your username was joe and you wanted to mount your home storage directory that's in a home directory on another machine with an SSH server running. First, make a directory on the machine you want to mount the drive to with say,
mkdir /home/joe/virtual_storage
and then run the command,
shfsmount joe@192.168.0.101:/home/joe/storage /home/joe/virtual_storage
and that's it. Now you can cd into virtual_storage and work with that directory as if it was on your machine. You may want to do a man shfsmount because there are many options. I us the -o option in combination with things like sid and gid and permissions to mount the directory in ... etc. You can find your sid and gid in /etc/passwd and /etc/group although if you don't own the machine, you'll probably have to find out your user id and group id from you administrator.
Using rar for .rar files
To install rar do
# emerge rar
To unrar a file called basque.rar into a directory to be created called new_dir you would use this command,
# unrar e basque.rar new_dir/
Make sure to have the slash at the end.
