首页 > 编程知识 正文

包含cups4jserver的词条

时间:2024-04-24 11:43:18 阅读:334040 作者:JKMW

本文目录一览:

win7系统如何配置samba服务器

具体方法如下:

一般你装系统的时候会默认安装samba,如果没有安装,只需要运行这个命令安装(CentOS):

“yum install -y samba samba-client”

Samba的配置文件为/etc/samba/smb.conf,通过修改这个配置文件来完成我们的各种需求。打开这个配置文件,你会发现很多内容都用”#”或者”;”注视掉了。先看一下未被注释掉的部分:

[global]

workgroup = MYGROUP

server string = Samba Server Version %v

security = user

passdb backend = tdbsam

load printers = yes

cups options = raw

[homes]

comment = Home Directories

browseable = no

writable = yes

[printers]

comment = All Printers

path = /var/spool/samba

browseable = no

guest ok = no

writable = no

printable = yes

主要有以上三个部分:[global], [homes], [printers]。

[global]定义全局的配置,”workgroup”用来定义工作组,相信如果你安装过windows的系统,你会对这个workgroup不陌生。一般情况下,需要我们把这里的”MYGROUP”改成”WORKGROUP”(windows默认的工作组名字)。

security = user #这里指定samba的安全等级。关于安全等级有四种:

share:用户不需要账户及密码即可登录samba服务器

user:由提供服务的samba服务器负责检查账户及密码(默认)

server:检查账户及密码的工作由另一台windows或samba服务器负责

domain:指定windows域控制服务器来验证用户的账户及密码。

passdb backend = tdbsam # passdb backend (用户后台),samba有三种用户后台:smbpasswd, tdbsam和ldapsam.

smbpasswd:该方式是使用smb工具smbpasswd给系统用户(真实用户或者虚拟用户)设置一个Samba 密码,客户端就用此密码访问Samba资源。smbpasswd在/etc/samba中,有时需要手工创建该文件。

tdbsam:使用数据库文件创建用户数据库。数据库文件叫passdb.tdb,在/etc/samba中。passdb.tdb用户数据库可使用smbpasswd –a创建Samba用户,要创建的Samba用户必须先是系统用户。也可使用pdbedit创建Samba账户。pdbedit参数很多,列出几个主要的:

pdbedit –a username:新建Samba账户。

pdbedit –x username:删除Samba账户。

pdbedit –L:列出Samba用户列表,读取passdb.tdb数据库文件。

pdbedit –Lv:列出Samba用户列表详细信息。

pdbedit –c “[D]”–u username:暂停该Samba用户账号。

pdbedit –c “[]”–u username:恢复该Samba用户账号。

ldapsam:基于LDAP账户管理方式验证用户。首先要建立LDAP服务,设置“passdb backend = ldapsam:ldap://LDAP Server”

load printers 和 cups options 两个参数用来设置打印机相关。

除了这些参数外,还有几个参数需要你了解:

netbios name = MYSERVER # 设置出现在“网上邻居”中的主机名

hosts allow = 127. 192.168.12. 192.168.13. # 用来设置允许的主机,如果在前面加”;”则表示允许所有主机

log file = /var/log/samba/%m.log #定义samba的日志,这里的%m是上面的netbios name

max log size = 50 # 指定日志的最大容量,单位是K

[homes]该部分内容共享用户自己的家目录,也就是说,当用户登录到samba服务器上时实际上是进入到了该用户的家目录,用户登陆后,共享名不是homes而是用户自己的标识符,对于单纯的文件共享的环境来说,这部分可以注视掉。

[printers]该部分内容设置打印机共享。

【samba实践】

注意:在试验之前,请先检测selinux是否关闭,否则可能会试验不成功。关于如何关闭selinux请查看第十五章 linux系统日常管理的“linux的防火墙”部分

1. 共享一个目录,任何人都可以访问,即不用输入密码即可访问,要求只读。

打开samba的配置文件/etc/samba/smb.conf

[global]部分

把”MY GROUP”改成”WORKGROUP”

把”security = user” 修改为“security = share”

然后在文件的最末尾处加入以下内容:

[share]

comment = share all

path = /tmp/samba

browseable = yes

public = yes

writable = no

mkdir /tmp/samba

chmod 777 /tmp/samba

启动samba服务

/etc/init.d/smb start

测试:

首先测试你配置的smb.conf是否正确,用下面的命令

testparm

如果没有错误,则在你的windows机器上的浏览器中输入 看是否能访问

2. 共享一个目录,使用用户名和密码登录后才可以访问,要求可以读写

打开samba的配置文件/etc/samba/smb.conf

[global] 部分内容如下:

[global]

workgroup = WORKGROUP

server string = Samba Server Version %v

security = user

passdb backend = tdbsam

load printers = yes

cups options = raw

然后加入以下内容:

[myshare]

comment = share for users

path = /samba

browseable = yes

writable = yes

public = no

保存配置文件,创建目录:

mkdir /samba

chmod 777 /samba

然后添加用户。因为在[globa]中” passdb backend = tdbsam”,所以要使用” pdbedit” 来增加用户,注意添加的用户必须在系统中存在。

useradd user1 user2

pdbedit -a user1 # 添加user1账号,并定义其密码

pdbedit -a user2

pdbedit -L # 列出所有的账号

测试:

打开IE浏览器输入 然后输入用户名和密码

3. 使用linux访问samba服务器

Samba服务在linux下同样可以访问。前提是你的linux安装了samba-client软件包。安装完后就可以使用smbclient命令了。

smbclient //IP/共享名 -U 用户名

如:[root@localhost]# smbclient //10.0.4.67/myshare/ -U user1

Password:

Domain=[LOCALHOST] OS=[Unix] Server=[Samba 3.0.33-3.29.el5_6.2]

smb:

出现如上所示的界面。可以打一个”?”列出所有可以使用的命令。常用的有cd, ls, rm, pwd, tar, mkdir, chown, get, put等等,使用help + 命令可以打印该命令如何使用,其中get是下载,put是上传。

另外的方式就是通过mount挂载了:

如:

mount -t cifs //10.0.4.67/myshare /mnt -o username=user1,password=123456

格式就是这样,要指定-t cifs //IP/共享名本地挂载点 -o后面跟username 和 password

挂载完后就可以像使用本地的目录一样使用共享的目录了。

Ubuntu怎么查看谁调用的cupsd

sudo service cups stop

sudo rm /etc/cups/subscriptions.conf*

sudo rm -r /var/cache/cups

sudo service cups start

如何在Ubuntu服务器上设置Web配置的打印服务器使用SWAT,CUPS和SAMBA

1、安装有关Samba的RPM包(samba、samba-common、samba-client)

2、创建Samba用户

3、修改配置文件

4、重启samba服务

5、设置目录访问权限

6、测试

具体步骤如下:

1、安装RPM包(缺省情况下RHEL5安装了samba的相关软件包,可以用如下命令查看)

[root@localhost ~]#rpm -qa | grep samba

samba -----samba服务器程序的所有文件

samba-common -----提供了Samba服务器和客户机中都必须使用的公共文件

samba-client -----提供了Samba客户机的所有文件

samba-swat -----以Web界面的形式提供了对Samba服务器的管理功能

2、创建samba用户

[root@localhost ~]#smbpasswd -a user1 (“-a”是创建samba用户,“-x”是删 [root@localhost ~]#smbpasswd -a user2 除samba用户,“-d”是禁用samba用

[root@localhost ~]#smbpasswd -a user3 户帐号,“-e”是启用samba用户帐号)

3、修改配置文件

samba配置文件的位置:/etc/samba/smb.conf

[root@localhost ~]#vim /etc/samba/smb.conf

Vi大开配置文件后,首先介绍一下Samba服务器的安全级别,如图所示:系统默认设置“user”

Samba服务器的安全级别分为5种,分别是user、share、server、domain和ads。在设置不同的级别时,samba服务器还会使用口令服务器和加密口令。

1、user -----客户端访问服务器时需要输入用户名和密码,通过验证后,才能使用服务器的共享资源。此级别使用加密的方式传送密码。

2、share -----客户端连接服务器时不需要输入用户名和密码

3、server -----客户端在访问时同样需要输入用户名和密码,但是,密码验证需要密码验证服务器来负责。

4、domain -----采用域控制器对用户进行身份验证

5、ads -----若samba服务器加入到Windows活动目录中,则使用ads安全级别,ads安全级别也必须指定口令服务器

共享目录的配置

[homes] -----samba用户的宿主目录

comment = Home Directories -----设置共享的说明信息

browseable = no -----目录浏览权限

writable = yes -----用户对共享目录可写

这个共享目录只有用户本身可以使用,默认情况下,用户主目录位于/home目录下,每个Linux用户有一个以用户名命名的子目录。

以下是共享打印机的设置:

[printers] -----共享打印机

comment = All Printers -----设置共享的说明信息

path = /var/spool/samba -----指定共享目录的路径

browseable = no -----目录浏览权限

guest ok = no -----允许来宾访问

writable = no -----用户对共享目录可写

printable = yes -----可以打印

以上是系统默认设置

添加自定义的共享目录:( user1对/ASUS有所有权,user2拥有只读权限,其他用户不能访问;public共享目录允许所有用户访问及上传文件)

[ASUS]

comment = user1 Directories -----设置共享的说明信息

browseable = yes -----所有samba用户都可以看到该目录

writable = yes -----用户对共享目录可写

path = /ASUS -----指定共享目录的路径

[public]

comment = all user Directories -----设置共享的说明信息

browseable = yes -----所有samba用户都可以看到该目录

writable = yes -----用户对共享目录可写

path = /public -----指定共享目录的路径

guest ok = yes -----允许来宾访问

4、修改完配置文件后需要重启samba服务

[root@localhost ~]#service smb restart

Samba服务器包括两个服务程序

2 smbd

? smbd服务程序为客户机提供了服务器中共享资源的访问

2 nmbd

? nmbd服务程序提供了NetBIOS主机名称的解析,为Windows网络中域或者工作组内的主机进行主机名称的解析

5、设置目录权限

[root@localhost ~]#mkdir /ASUS ------创建要共享目录

[root@localhost ~]#mkdir /public ------创建要共享的目录

[root@localhost ~]#chmod 750 /ASUS ------修改/ASUS权限(属主拥有

所有权,属组只读,其它用户不能访问)

[root@localhost ~]#chown user1 /ASUS ------将/ASUS的属主改为user1

[root@localhost ~]#groupadd ASUS ------添加ASUS组

[root@localhost ~]#usermod –G ASUS user1 ------将user1加入到ASUS组

[root@localhost ~]#usermod –G ASUS user2 ------将user2加入到ASUS组

[root@localhost ~]#chgrp ASUS /ASUS ------将/ASUS的属组改为

ASUS

[root@localhost ~]#chmod 777 /public ------给所有用户分配完全控制

权限

配置完成后,还要检查/etc/service文件中以“netbios”开头的记录,正确的文件

记录如下所示,如果这些记录前有#或没有这些记录,应手工添加,否则用户无

法访问Linux服务器上的共享资源

6、测试

找一台内网windows客户端,打开“网上邻居 ”,输入samba服务器的IP点击

“搜索”

如图所示:已经搜索到

双击打开,如图所示:提示输入用户名和密码,先来输入user1的用户名和密码

作测试。

登录成功,

打开user1的宿主目录,此目录user1是拥有所有权限的,创建一个目录测试一

下,如图所示:可以创建

Public目录是允许任何用户上传、下载及删除文件,如图所示

User1对ASUS目录拥有完全控制权限,所以user1可以在此目录下作任何操作

切换另一个用户测试,由于我们在同一台计算机上作测试,测试之前首先要清楚

计算机上的缓存,如图所示:打开 “命令提示符模式”,“net use /del *”是清

除计算机上缓存

重新打开网上邻居,找到Samba 服务器的共享资源,以user2的身份登录

以下几幅图片可以看到,user2对ASUS目录拥有只读权限,对public、user2目

录拥有所有权

再切换一个用户登录,记得要清除缓存哦,输入user3的用户名及密码

如图所示:user3无法访问ASUS目录

User3只对user3和public目录拥有所有权

redhat enterprise 如何配置samba服务器

/etc/samba/smb.conf主配置文件,此文件中有丰富的说明注释

使用smbpasswd命令使Linux系统用户成为Samba用户,命令格式如下:

smbpasswd –a 用户名

SMB.CONF具体实例

# This is the main Samba configuration file. You should read the

# smb.conf(5) manual page in order to understand the options listed

# here. Samba has a huge number of configurable options (perhaps too

# many!) most of which are not shown in this example

#

# Any line which starts with a ; (semi-colon) or a # (hash)

# is a comment and is ignored. In this example we will use a #

# for commentry and a ; for parts of the config file that you

# may wish to enable

#

# NOTE: Whenever you modify this file you should run the command "testparm"

# to check that you have not many any basic syntactic errors.

#

#======================= Global Settings =====================================

[global]

# workgroup = NT-Domain-Name or Workgroup-Name

workgroup = Workgroup ;计算机所在的工作组名或域名

netbios name = fileserver ;即在,网上邻居中显示的计算机名

# server string is the equivalent of the NT Description field

server string = Samba Server ;计算机描述

This option is important for security. It allows you to restrict

# connections to machines which are on your local network. The

# following example restricts access to two C class networks and

# the "loopback" interface. For more examples of the syntax see

# the smb.conf man page

; hosts allow = 192.168.1. 192.168.2. 127. ;允许访问的计算机的IP地址

; hosts allow = 172.16.0. 172.16.3. 127.

# if you want to automatically load your printer list rather

# than setting them up individually then you'll need this

; printcap name = /etc/printcap加载打印机的配置路径

load printers = no是否将打印机共享

# It should not be necessary to spell out the print system type unless

# yours is non-standard. Currently supported print systems include:

# bsd, sysv, plp, lprng, aix, hpux, qnx

; printing = cups一种打印驱动模式,即LINUX支持的标准打印类型。其LINUX支持的打印类型有bsd, sysv, plp, lprng, aix, hpux, qnx

# Uncomment this if you want a guest account, you must add this to /etc/passwd

# otherwise the user "nobody" is used

; guest account = nobody

guest account = guest ;允许访问(不需要用户名与密码)也可以指定任何系统内置的一个帐号做为来宾帐号。

# this tells Samba to use a separate log file for each machine

# that connects

log file = /var/log/samba/%m.log.会给用户在此目录下做每个SAMBA用户登录的日志。

# Put a capping on the size of the log files (in Kb).

max log size = 50日志 文件限制在50K内

# Security mode. Most people will want user level security. See

# security_level.txt for details.

security = share

; security = user

# Use password server option only with security = server

; password server = NT-Server-Name此行的作用为如果上面的选项为SERVER,则SAMBA服务器在做身份识别的时候,把WIN机器发过来的密码同用户名交给此项设定的密码服务器验证。

# Password Level allows matching of _n_ characters of the password for

# all combinations of upper and lower case.

; password level = 8

; username level = 8(对于从前的几款老式的WINDOWS系统对于大小写密码支持的不是很好,所以开启上面的两个参数的意义是在密码为8位的用户名与密码的帐号里自动匹配所有的大小写测试)

# You may wish to use password encryption. Please read

# ENCRYPTION.txt, Win95.txt and WinNT.txt in the Samba documentation.

# Do not enable this option unless you have read those documents

encrypt passwords = yes(加密明文的SAMBA密码进行发送)

smb passwd file = /etc/samba/smbpasswd验证密码所在的目录

# The following are needed to allow password changing from Windows to

# update the Linux sytsem password also.

# NOTE: Use these with 'encrypt passwords' and 'smb passwd file' above.

# NOTE2: You do NOT need these to allow workstations to change only

# the encrypted SMB passwords. They allow the Unix password

# to be kept in sync with the SMB password.

# Windows Internet Name Serving Support Section:

# WINS Support - Tells the NMBD component of Samba to enable it's WINS Server

; wins support = yes把该服务器配置为WINS服务器

# WINS Server - Tells the NMBD components of Samba to be a WINS Client

# Note: Samba can be either a WINS Server, or a WINS Client, but NOT both

; wins server = 192.168.1.100也可以指定一个WINS服务器,让自己成为WINS客户

# WINS Proxy - Tells Samba to answer name resolution queries on

# behalf of a non WINS capable client, for this to work there must be

# at least one WINS Server on the network. The default is NO.

; wins proxy = yes(针对老式计算机,不用设置)

# DNS Proxy - tells Samba whether or not to try to resolve NetBIOS names

# via DNS nslookups. The built-in default for versions 1.9.17 is yes,

# this has been changed in version 1.9.18 to no.

dns proxy = no(针对老式计算机,不用设置)

# Case Preservation can be handy - system default is _no_

# NOTE: These can be set on a per share basis

; preserve case = no

; short preserve case = no

# Default case is normally upper case for all DOS files

; default case = lower

# Be very careful with case sensitivity - it can break things!

; case sensitive = no

(整个上面这段为讨论与WINDWOS文件系统的大小写问题因为微软的系统是一个大小写不区分 的系统,默认用默认值即可。因为修改可能造成与WINDOWS的不兼容问题)

#============================ Share Definitions ==============================

[homes]作为登录用户,自己访问自己目录的设置。

; comment = Home Directories目录说明

; browseable = no用户私人目录不需要给别人浏览。

; writable = yes也可以用read only=no来替代

# Un-comment the following and create the netlogon directory for Domain Logons

; [netlogon]域用户登录目录设置。

; comment = Network Logon Service

; path = /home/netlogon

; guest ok = yes

; writable = no

; share modes = no

# Un-comment the following to provide a specific roving profile share

# the default is to use the user's home directory

;[Profiles]

; path = /home/profiles

; browseable = no

; guest ok = yes

# NOTE: If you have a BSD-style print system there is no need to

# specifically define each individual printer

[printers]打印机共享

comment = All Printers说明共享全部打印机

path = /var/spool/samba打印机池,用户必须手工创建该目录。

browseable = no

# Set public = yes to allow user 'guest account' to print

guest ok = no

writable = no

printable = yes用户是否可以打印

# This one is useful for people to share files

;[tmp]

; comment = Temporary file space

; path = /tmp

; read only = no可以写入

; public = yes即目录是否共享给来宾帐号。

# A publicly accessible directory, but read only, except for people in

# the "staff" group

[public]

comment = Public Stuff

path = /home/soft

public = yes

guest ok = yes以上两个public=yes代表来宾帐号能访问此共享目录,但guest ok代表密码不是必须的,可以不加。

writable = yes

printable = no

write list = @staff此参数告诉我们不必要让所有人访问共享目录,可以有staff这个组的成员能访问,但在passwd和shadow文件中要存在这个组。

# Other examples.

#

# A private printer, usable only by fred. Spool data will be placed in fred's

# home directory. Note that fred must have write access to the spool directory,

# wherever it is.

;[fredsprn](设置仅供一人使用的共享打印机)

; comment = Fred's Printer;

valid users = fred

; path = /homes/fred

; printer = freds_printer

; public = no

; writable = no

; printable = yes

# A private directory, usable only by fred. Note that fred requires write

# access to the directory.

;[fredsdir] (为创建一个私有目录,别人都不能访问,只有fred这个用户能访问)

; comment = Fred's Service

; path = /usr/somewhere/private

; valid users = fred

; public = no

; writable = yes

; printable = no

# a service which has a different directory for each machine that connects

# this allows you to tailor configurations to incoming machines. You could

# also use the %u option to tailor it by user name.

# The %m gets replaced with the machine name that is connecting.

;[pchome]

; comment = PC Directories

; path = /usr/pc/%m

; public = no

; writable = yes

# A publicly accessible directory, read/write to all users. Note that all files

# created in the directory by users will be owned by the default user, so

# any user with access can delete any other user's files. Obviously this

# directory must be writable by the default user. Another user could of course

# be specified, in which case all files would be owned by that user instead.

;[public]

; path = /usr/somewhere/else/public

; public = yes

; only guest = yes

; writable = yes

; printable = no

# The following two entries demonstrate how to share a directory so that two

# users can place files there that will be owned by the specific users. In this

# setup, the directory should be writable by both users and should have the

# sticky bit set on it to prevent abuse. Obviously this could be extended to

# as many users as required.

;[myshare]这个例子是配置一个仅供两个用户访问的目录

; comment = Mary's and Fred's stuff

; path = /usr/somewhere/shared

; valid users = mary fred

; public = no

; writable = yes

; printable = no

; create mask = 0765

最后建议在图形界面配置比较简单

在LINUX提示符下输入startx

即可进入图形界面 和WINDOWS差不多 窗口化的配置比较直观也比较简单

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。