Set the Linux Printer Server
The procedure below is tested on Linux Printer Server running Ubuntu 10.10 and CUPS 1.4.4. To setup the Linux Printer Server, make sure that the server can print into the connected printer. Once this is done, you can enable print sharing.
a) Click on System -> Administration -> Printing
b) Click on Add Printer and select your printer on the listed items
c) Afterwards, test if you can print from your server.
d) Enable print sharing by right-clicking on the printer and selecting "Properties" menu.
e) On the Policies, check the State "Enabled, Accepting jobs, and Shared"
f) Under access control select the button "Deny printing for everyone except these users:", then type in the list of users you want to share printer and click on the "Add" button. (e.g., bisita - this should be equivalent to the user logged in on the client machine)
g) Click on the button "Apply" then "OK"
h) On the "Printer Configuration" window, select the Server->Settings menu.
i) Check the item "Publish shared printers connected to this system", and "Allow printing from the Internet", then click on the OK button.
j) Restart the cups daemon by typing on the terminal:
# /etc/init.d/cups restart
On a Linux Client Machine
a) Click on System->Administration->Printing
b) Click on the Add button
c) Under the "Network Printer", select "Internet Printing Protocol"
d) Under the Host field, type in the IP address of the printer server (e.g., 192.168.1.10)
e) Under the Queue field, type in the name of the printer after the prefix /printers/ (e.g., /printers/hp900)
f) Click the button to "Verify" to confirm if your settings are good.
g) Then click the "Forward" button and select your printer on the listed items
h) Type in a description of your printer (e.g., hp900)
i) Finalized the setup by clicking the "Apply" and "OK" button
If everything goes smoothly, you should be able to print from your Linux client machine to your Linux Printer Server.
Windows Printing Thru CUPS
Windows can print to a Linux Print Server running cups. I assume that the CUPS server has been properly installed on a Linux server and it has been set as "sharing". The following procedure is how to set the printer under Windows (I have tested it under Windows XP Home Edition but my guess is it should work on most Windows variants):
a) Add Printer
b) Select "Connect Printer to the Internet"
c) Type in the address of CUPS server and the print queue (e.g., http://192.168.1.117:631/printers/hp900)
d) When prompted for the printer type, select "Generic", then select "MS Publisher Imagesetter" (This is usually a built in driver on Windows)
That's it.
Test your printing. You can monitor the status of your printing by going to your browser and typing the address (e.g., http://192.168.1.117:631) and clicking on the "Jobs" menu.
Erratum: The above procedure does not work with Windows 7 Starter Edition.
Printer Sharing via LPD
Print Sharing thru the legacy LPD is implemented via the cups-lpd daemon. This is activated through the xinetd superserver daemon. The procedure are as follows:
a) On the Linux Printer Server, download the xinetd superserver daemon xinetd by typing the command on the terminal:
# apt-get install xinetd
b) Configure the xinetd daemon by typing creating the a (e.g., printer ) under the directory /etc/xinetd.d/ and typing the following settings:
service printer
{
socket_type = stream
protocol = tcp
wait = no
user = bisita
group = sys
server = /usr/lib/cups/daemon/cups-lpd
server_args = -o document-format=application/octet/stream
}
c) Start the xinetd server by typing the command:
# /etc/init.d/xinetd start
d) Create the file hosts.lpd under the directory /etc and type in the name of allowed hosts (e.g., mydesktop ). Be sure the hostname mydesktop can be properly identified in the network. If not, include the name under the hosts file.
Printer Sharing under SMB protocol
The procedure below assumes that you have done the above procedure on Printer Sharing via LPD. The reason for this is that the Samba Server setup here for printing relies on the bsd as the printing mode.
a) Download and install the Samba software in the server.
# apt-get install samba
b) Configure the Samba server by editing the file /etc/samba/smb.conf given the pattern below:
[global]
workgroup = RASUL
netbios name = TIKBALANG
passdb backend = tdbsam
printcap name = cups
printing = bsd
load printers = yes
[printers]
comment = All Printers
browseable = yes
security = share
use client driver = yes
guest ok = yes
path = /var/spool/smbprint
printable = yes
public = yes
writable = yes
create mode = 0700
c) Create the directory /var/spool/smprint and change the ownership to 777 mode.
# mkdir /var/spool/smbprint
# chmod 777 /var/spool/smbprint
d) Restart the Samba server as follows:
#/etc/init.d/nmbd restart
#/etc/init.d/smbd restart
Afterwards, test if you can print from a Windows or Linux client machine.
Friday, July 8, 2011
Friday, July 1, 2011
Setting the Network Card to Static IP on Ubuntu
Edit the /etc/network/interaces file to:
auto eth1
iface eth1 inet static
address 10.10.10.2
netmask 255.255.255.0
gateway 10.10.10.1
dns-nameservers 10.10.10.250 10.10.10.251
Wednesday, June 29, 2011
Sample smb.conf File
[global]
netbios name = KAPRE
workgroup = HEDCEN
server string = HedCen File Server
security = user
guest account = bisita
[teachers]
path = /home/teacher/Documents
writeable = yes
valid users = @teacher
locking = yes
create mode = 0660
directory mode = 0770
[students]
path = /home/student/Documents
writeable = yes
valid users = @student
locking = yes
create mode = 0660
directory mode = 0770
[home]
comment = Home Directory
path = %H
valid users = %S
create mode = 0600
directory mode = 0700
locking = no
netbios name = KAPRE
workgroup = HEDCEN
server string = HedCen File Server
security = user
guest account = bisita
[teachers]
path = /home/teacher/Documents
writeable = yes
valid users = @teacher
locking = yes
create mode = 0660
directory mode = 0770
[students]
path = /home/student/Documents
writeable = yes
valid users = @student
locking = yes
create mode = 0660
directory mode = 0770
[home]
comment = Home Directory
path = %H
valid users = %S
create mode = 0600
directory mode = 0700
locking = no
Friday, June 17, 2011
HedCen Squid Server
acl all src all
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl blocksites url_regex "/etc/squid/block-squid.acl"
acl blocktime url_regex "/etc/squid/timeblock-squid.acl"
acl morning time 07:00-12:00
acl okam1 time 00:00-06:59
acl okam2 time 12:01-12:29
acl afternoon time 12:30-19:00
acl okpm1 time 19:01-23:59
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT
http_access deny blocksites
http_access deny morning blocktime
http_access deny afternoon blocktime
http_access allow okam1 blocktime
http_access allow okam2 blocktime
http_access allow okpm1 blocktime
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localnet
http_access allow localhost
http_access deny all
icp_access allow localnet
icp_access deny all
http_port 3128 transparent
hierarchy_stoplist cgi-bin ?
access_log /var/log/squid/access.log squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320
acl shoutcast rep_header X-HTTP09-First-Line ^ICY.[0-9]
upgrade_http0.9 deny shoutcast
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
coredump_dir /var/spool/squid
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl blocksites url_regex "/etc/squid/block-squid.acl"
acl blocktime url_regex "/etc/squid/timeblock-squid.acl"
acl morning time 07:00-12:00
acl okam1 time 00:00-06:59
acl okam2 time 12:01-12:29
acl afternoon time 12:30-19:00
acl okpm1 time 19:01-23:59
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT
http_access deny blocksites
http_access deny morning blocktime
http_access deny afternoon blocktime
http_access allow okam1 blocktime
http_access allow okam2 blocktime
http_access allow okpm1 blocktime
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localnet
http_access allow localhost
http_access deny all
icp_access allow localnet
icp_access deny all
http_port 3128 transparent
hierarchy_stoplist cgi-bin ?
access_log /var/log/squid/access.log squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320
acl shoutcast rep_header X-HTTP09-First-Line ^ICY.[0-9]
upgrade_http0.9 deny shoutcast
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
coredump_dir /var/spool/squid
HedCen DHCP Server
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
ddns-update-style interim;
ignore client-updates;
subnet 10.10.10.0 netmask 255.255.255.0 {
range 10.10.10.10 10.10.10.110;
option routers 10.10.10.1;
option subnet-mask 255.255.255.0;
option domain-name "hedcen.portal.ph";
option domain-name-servers 10.10.10.1;
option netbios-name-servers 10.10.10.1;
default-lease-time 21600;
max-lease-time 43200;
}
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
ddns-update-style interim;
ignore client-updates;
subnet 10.10.10.0 netmask 255.255.255.0 {
range 10.10.10.10 10.10.10.110;
option routers 10.10.10.1;
option subnet-mask 255.255.255.0;
option domain-name "hedcen.portal.ph";
option domain-name-servers 10.10.10.1;
option netbios-name-servers 10.10.10.1;
default-lease-time 21600;
max-lease-time 43200;
}
Transparent Squid Setup Firewall Script
#!/bin/bash
echo 1 > /proc/sys/net/ipv4/ip_forward
# Flush rules
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128
iptables -t nat -A POSTROUTING -s 10.10.10.0/255.255.255.0 -d 0.0.0.0/0.0.0.0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
# Flush rules
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128
iptables -t nat -A POSTROUTING -s 10.10.10.0/255.255.255.0 -d 0.0.0.0/0.0.0.0 -j MASQUERADE
Thursday, June 2, 2011
Sample Squid Configuration File
The following is a sample squid 2.7 configuration file (/etc/squid/squid.conf):
acl all src all
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl blocksites url_regex "/etc/squid/squid-block.acl"
acl officehour time M T W H F 9:00-16:59
acl afteroffice time 17:00-24:00
acl beforeoffice time 00:00-6:00
acl banned dst www.pornsite.com
acl SSL_ports port 443 # https
acl SSL_ports port 563 # snews
acl SSL_ports port 873 # rsync
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl Safe_ports port 631 # cups
acl Safe_ports port 873 # rsync
acl Safe_ports port 901 # SWAT
acl purge method PURGE
acl CONNECT method CONNECT
http_access allow afteroffice blocksites
http_access allow beforeoffice blocksites
http_access deny blocksites
http_access deny banned
http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access deny all
icp_access allow localnet
icp_access deny all
http_port 3128
hierarchy_stoplist cgi-bin ?
access_log /var/log/squid/access.log squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern (Release|Package(.gz)*)$ 0 20% 2880
refresh_pattern . 0 20% 4320
acl shoutcast rep_header X-HTTP09-First-Line ^ICY.[0-9]
upgrade_http0.9 deny shoutcast
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
extension_methods REPORT MERGE MKACTIVITY CHECKOUT
hosts_file /etc/hosts
coredump_dir /var/spool/squid
acl all src all
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl blocksites url_regex "/etc/squid/squid-block.acl"
acl officehour time M T W H F 9:00-16:59
acl afteroffice time 17:00-24:00
acl beforeoffice time 00:00-6:00
acl banned dst www.pornsite.com
acl SSL_ports port 443 # https
acl SSL_ports port 563 # snews
acl SSL_ports port 873 # rsync
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl Safe_ports port 631 # cups
acl Safe_ports port 873 # rsync
acl Safe_ports port 901 # SWAT
acl purge method PURGE
acl CONNECT method CONNECT
http_access allow afteroffice blocksites
http_access allow beforeoffice blocksites
http_access deny blocksites
http_access deny banned
http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access deny all
icp_access allow localnet
icp_access deny all
http_port 3128
hierarchy_stoplist cgi-bin ?
access_log /var/log/squid/access.log squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern (Release|Package(.gz)*)$ 0 20% 2880
refresh_pattern . 0 20% 4320
acl shoutcast rep_header X-HTTP09-First-Line ^ICY.[0-9]
upgrade_http0.9 deny shoutcast
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
extension_methods REPORT MERGE MKACTIVITY CHECKOUT
hosts_file /etc/hosts
coredump_dir /var/spool/squid
Saturday, May 28, 2011
Installing Windows Fonts on Ubuntu Linux
There are three (3) ways to install Windows fonts on Ubuntu Linux. I have tested the following procedure under Ubuntu 10.10 Linux distribution but my guess is it should also work on other Linux distributions as well.
Way No. 1
(1) Access the Linux terminal by accessing the menu, Applications->Accessories->Terminal
(2) On the terminal, you have to be user "root" to install the package. To become "root", issue the command:
$ sudo su
This will prompt you for your password. Type in your password. If you are "root", the prompt should change from $ to #.
(3) To download and install the Windows fonts, type the command:
# apt-get install ttf-mscorefonts-installer
(4) To load the fonts, type the command:
# fc-cache -f -v
I am assuming that your computer is connected to the Internet and therefore by issuing the above-mentioned commands, installation of the fonts becomes trivial. As far as I know, you can also use the "Ubuntu Software Center" (click Applications->Ubuntu Software Center) and look for the MS True Type Fonts package.
If you are curious as to where the fonts are located, Ubuntu Linux copies the fonts to the directory "/usr/share/fonts". This directory is only accessible to the "root" user.
Way No. 2
In way 2, we will be installing fonts by manually copying the Windows fonts files and pasting it in the Ubuntu Linux directory.
(1) Copy the Windows fonts in your computer and place it in a transferable media such as a USB stick or CD.
(2) On the Ubuntu Linux computer, access the default home directory by going to "Places->Home Folder". On the home folder, check the "Show Hidden Files" on the "View" menu.
(3) Create the folder ".fonts". Yes, the folder got a dot before the word fonts. On Linux, folders with beginning dots means hidden folders.
(4) Copy the Windows fonts to the ".fonts" folder.
(5) Load the fonts by issuing the command:
$ fc-cache -f -v
As you can see, you don't need to be a "root" user to do this procedure. The fonts however will only be applied to the current user but not system wide unlike Way 1 procedure.
Way No. 3
In way 3, the procedure involves making the fonts available system-wide.
(1) On the terminal, become "root" by issuing the command:
$ sudo su
(2) Access the file manager in root mode by issuing the command:
# nautilus&
The file manager is called nautilus. The & makes the program independent of the terminal where it is run.
(3) Since you are already on the graphical file manager as "root", copy the Windows fonts to the Ubuntu Linux directory "/usr/share/fonts". I suggest creating a separate folder under this like "msttcorefonts".
(4) Load the fonts by issuing the command in the terminal:
# fc-cache -f -v
Other fonts can also be installed on Linux by following way 2 and 3 procedure above.
By the way, if you are concerned about licensing, the Microsoft Core fonts I have mentioned above can be redistributed freely as depicted in its license terms.
Way No. 1
(1) Access the Linux terminal by accessing the menu, Applications->Accessories->Terminal
(2) On the terminal, you have to be user "root" to install the package. To become "root", issue the command:
$ sudo su
This will prompt you for your password. Type in your password. If you are "root", the prompt should change from $ to #.
(3) To download and install the Windows fonts, type the command:
# apt-get install ttf-mscorefonts-installer
(4) To load the fonts, type the command:
# fc-cache -f -v
I am assuming that your computer is connected to the Internet and therefore by issuing the above-mentioned commands, installation of the fonts becomes trivial. As far as I know, you can also use the "Ubuntu Software Center" (click Applications->Ubuntu Software Center) and look for the MS True Type Fonts package.
If you are curious as to where the fonts are located, Ubuntu Linux copies the fonts to the directory "/usr/share/fonts". This directory is only accessible to the "root" user.
Way No. 2
In way 2, we will be installing fonts by manually copying the Windows fonts files and pasting it in the Ubuntu Linux directory.
(1) Copy the Windows fonts in your computer and place it in a transferable media such as a USB stick or CD.
(2) On the Ubuntu Linux computer, access the default home directory by going to "Places->Home Folder". On the home folder, check the "Show Hidden Files" on the "View" menu.
(3) Create the folder ".fonts". Yes, the folder got a dot before the word fonts. On Linux, folders with beginning dots means hidden folders.
(4) Copy the Windows fonts to the ".fonts" folder.
(5) Load the fonts by issuing the command:
$ fc-cache -f -v
As you can see, you don't need to be a "root" user to do this procedure. The fonts however will only be applied to the current user but not system wide unlike Way 1 procedure.
Way No. 3
In way 3, the procedure involves making the fonts available system-wide.
(1) On the terminal, become "root" by issuing the command:
$ sudo su
(2) Access the file manager in root mode by issuing the command:
# nautilus&
The file manager is called nautilus. The & makes the program independent of the terminal where it is run.
(3) Since you are already on the graphical file manager as "root", copy the Windows fonts to the Ubuntu Linux directory "/usr/share/fonts". I suggest creating a separate folder under this like "msttcorefonts".
(4) Load the fonts by issuing the command in the terminal:
# fc-cache -f -v
Other fonts can also be installed on Linux by following way 2 and 3 procedure above.
By the way, if you are concerned about licensing, the Microsoft Core fonts I have mentioned above can be redistributed freely as depicted in its license terms.
Subscribe to:
Posts (Atom)