Documentation for a newer release is available. View Latest

Servidores de Ficheros e Impresión

Este capitulo le guía a través de la instalación y configuración de Samba, una implementación de código abierto de los protocolos Servidor de Bloque de Mensaje (SMB) y sistemas de archivos común de Internet (CIFS) y de vsftpd, el servidor FTP principal enviado con Fedora. Adicionalmente, explica cómo usar la herramienta Printer para configurar impresoras.

Samba

Samba es el conjunto estándar de interoperabilidad de Windows en código abierto para Linux. Implementa el protocolo servidor de mensaje de bloque (SMB). Las versiones modernas de este protocolo también conocido como protocolo sistema de archivos común de Internet (CIFS). Permite la conexión en red de sistemas operativos Microsoft Windows, Linux, UNIX y otros juntos, habilitando el acceso a compartir ficheros basados en Windows e impresoras. El uso de Samba de SMB le permite aparecer como un servidor Windows a los clientes Windows.

Instalando el paquete samba

Con el objetivo de usar Samba, asegúrese primero de que el paquete samba está instalado en su sistema ejecutando como root:

~]# dnf install samba

Para más información sobre la instalación de paquetes con DNF, vea Instalando Paquetes.

Introducción a Samba

Samba es un componente importante para integrar sin problemas Servidores y Escritorios Linux en entornos Active Directory (AD). Puede funcionar tanto como controlador de dominio (estilo NT4) como un miembro regular del dominio (estilo AD o NT4). .Qué puede hacer Samba:

  • Servir árboles de directorios e impresoras a clientes Linux, UNIX y Windows

  • Ayudar en la navegación de por la red (con NetBIOS)

  • Autenticar accesos a dominios Windows

  • Suministrar resolución de nombre de servidor Servicio de Nombres de Internet Windows (WINS)

  • Actuar como un Controlador Principal de Dominio (PDC) estilo NT

  • Actuar como Controlador de Dominio de Respaldo (BDC) para un PDC basado en Samba

  • Actuar como servidor miembro de un dominio Active Directory

  • Unirse a un Windows NT/2000/2003/2008 PDC/Windows Server 2012

Qué no puede hacer Samba:
  • Actuar como BDC para un PDC Windows (y viceversa)

  • Actuar como controlador de dominio Active Directory

Samba está compuesto de tres demonios (smbd, nmbd y winbindd). Tres servicios (smb, nmb y winbind) que controlan como ser arrancan los demonios, se paran y otras características relacionadas con el servicio. Estos servicios actúan como diferentes scripts de arranque. Abajo se lista cada demonio en detalle así como que servicio específico controla sobre él.

smbd

El demonio servidor smbd suministra servicios de compartición de ficheros e impresoras a clientes Windows. Además, es responsable de la autenticación de usuario, el cierre de recursos y la compartición de datos a través del protocolo SMB. Los puertos predeterminados sobre los que el servidor escucha el tráfico SMB son los puertos TCP 139 y 445.

El demonio smbd está controlado por el servicio smb.

nmbd

El demonio servidor nmbd entiende y contesta a las peticiones del servicio de nombres NetBIOS como aquellas producidas or SMB/CIFS en sistemas basados en Windows. Estos sistemas incluyen clientes Windows 95/98/ME, Windows NT, Windows 2000, Windows XP y LanManager. También participa en los protocolos de navegación que componen la vista Entorno de Red de Windows. El puerto predeterminado en el que el servidor escucha tráfico NMB es el puerto UDP 137.

El demonio nmbd es controlado por el servicio nmb.

winbindd

El servicio winbind resuelve la información de usuario y grupo recibida por un servidor que está corriendo en Windows NT, 2000, 2003, Windows Server 2008, o Windows Server 2012. Esto hace que la información de usuario y grupo de Windows sea comprensible por las plataformas UNIX. Esto se consigue usando llamadas Microsoft RPC, Módulos de Autenticación Conectable (PAM) y el Cambio de Servicio de Nombre (NSS). Esto permite a los usuarios de dominio Windows NT y Active Directory aparecer y trabajar como usuarios UNIX sobre una máquina UNIX. Aunque está incluido con la distribución Samba, el servicio winbind es controlado por separado del servicio smb.

El demonio winbind es controlado por el servicio y no requiere que el servicio smb esté arrancado para trabajar. winbind también se usa cuando Samba es un miembro Active Directory y también puede ser usado sobre un controlador de dominio Samba (para implementar grupos anidados y confianza entre dominios). Como winbind es un servicio de lado cliente usado para conectar con servidores basados en Windows NT, una discusión más detallada sobre winbind está más allá del alcance de este capítulo.

Obtener una lista de utilidades que se envían con Samba

Vea en Distribución de Programas Samba una lista detallada de las utilidades incluidas en la distribución Samba.

Conectando a un Recurso Compartido de Samba

Puede usar bien Nautilus o bien la línea de comandos para conectar con los recursos compartidos Samba disponibles.

Conectando a un Recurso Compartido Samba Usando Nautilus
  1. Para visualizar una lista de los grupos de trabajo y dominios Samba en su red seleccione Otras Ubicaciones    Red desde el panel GNOME panel y seleccione después la red deseada. Alternativamente, teclee smb: Archivo    Abrir Localización en la barra de Nautilus.

    Aparece un icono por cada grupo de trabajo o dominio SMB disponible en la red.

    Grupos de Trabajo SMB en Nautilus
    Figura 1. Grupos de Trabajo SMB en Nautilus
  2. Haga doble pulsación sobre el icono de un grupo de trabajo o dominio para visualizar una lista de los ordenadores dentro del grupo de trabajo o dominio.

  3. Existe un icono por cada máquina dentro del grupo de trabajo. Haga doble pulsación sobre un icono para ver los recursos compartidos Samba en la máquina. Si se requiere una combinación de nombre de usuario y contraseña se le pedirá.

    Alternativamente, también puede especificar el servidor y nombre del recurso compartido Samba en la barra Localización: para Nautilus usando la siguiente sintaxis (reemplace nombre de servidor y nombre de recurso compartido con los valores apropiados):

    smb://nombre de servidor/nombre de recurso compartido

Conectando a Recurso Compartido Samba Usando la Línea de Comandos
  1. Para conectarse a un recurso compartido Samba desde la línea de comandos teclee lo siguiente:

    ~]$ smbclient //hostname/sharename -U username

    Reemplace hostname con el nombre de host o la dirección IP del servidor Samba con el que desee conectar, sharename con el nombre del directorio compartido que desea navegar y username con el nombre de usuario Samba para el sistema. Introduzca la contraseña correcta o pulse Enter si no se pide contraseña para el usuario.

    Si ve el símbolo de sistema smb:\> ha accedido con éxito. Una vez que ha accedido teclee help para obtener una lista de comandos. Si desea navegar por los contenidos de su directorio home reemplace sharename con su nombre de usuario. Si no se usa el modificador -U, se pasa el nombre de usuario actual al servidor Samba.

  2. Para salir de smbclient, teclee exit en el símbolo de sistema smb:\>.

Montando el Recurso Compartido

Algunas veces es útil montar un recurso compartido Samba para un directorio de modo que los ficheros en el directorio sean tratados como si fueran parte de un sistema de archivos local.

Para montar un recursos compartido Samba en un directorio, cree un directorio para montarlo (si no existe ya) y ejecute el siguiente comando como root:

mount -t cifs //servername/sharename /mnt/point/ -o username=username,password=password

Este comando monta sharename desde servername en el directorio local /mnt/point/.

Para más información sobre el montaje de un recurso compartido samba, vea la página de manual mount.cifs(8).

Instalando el paquete cifs-utils

La utilidad mount.cifs es un RPM separado (independiente de Samba). Con el objetivo de usar mount.cifs, asegúrese primero que el paquete cifs-utils está instalado en su sistema ejecutando como root:

~]# dnf install cifs-utils

Para más información sobre la instalación de paquetes con DNF, vea Instalando Paquetes.

Advierta que el paquete cifs-utils también contiene el binario cifs.upcall que es llamado por el kernel con el objetivo de llevar a cabo montajes CIFS kerberizados. Para mas información sobre cifs.upcall, vea la página de manual cifs.upcall(8).

Servidores CIFS que requieren contraseñas de texto plano

Algunos servidores CIFS requieren contraseñas de texto plano para autenticación. El soporte para contraseñas de texto plano puede ser habilitado usando el siguiente comando como root:

~]# echo 0x37 > /proc/fs/cifs/SecurityFlags
Esta operación puede exponer las contraseñas al quitar el cifrado de contraseña.
Configurando un Servidor Samba

El fichero de configuración predeterminado (/etc/samba/smb.conf) permite a los usuarios visualizar sus directorios home como un recurso compartido Samba. También comparte todas las impresoras configuradas para el sistema como impresoras Samba compartidas. Usted puede adjuntar una impresora al sistema e imprimir en ellas desde máquinas Windows en su red.

Graphical Configuration To configure Samba using a graphical interface, use one of the available Samba graphical user interfaces. A list of available GUIs can be found at http://www.samba.org/samba/GUI/.
Command-Line Configuration Samba uses /etc/samba/smb.conf as its configuration file. If you change this configuration file, the changes do not take effect until you restart the Samba daemon with the following command, as root:
~]# systemctl restart smb.service

Para especificar el grupo de trabajo Windows y una breve descripción del servidor Samba server, edite las siguientes líneas en su fichero /etc/samba/smb.conf:

workgroup = NOMBRE GRUPO DE TRABAJO
server string = BREVE COMENTARIO SOBRE EL SERVIDOR

Reemplace NOMBRE GRUPO DE TRABAJO con el nombre del grupo de trabajo Windows al que debería pertenecer esta máquina. El BRECE COMENTARIO SOBRE EL SERVIDOR es opcional y se usa como el comentario Windows sobre el sistema Samba.

Para crear un directorio de recursos compartido Samba sobre su sistema Linux, añada la siguiente sección en su fichero /etc/samba/smb.conf (después modifiquelo para reflejar sus necesidades y su sistema):

Ejemplo 1. Un Ejemplo de Configuración de un Servidor Samba
[sharename]
comment = Insert a comment here
path = /home/share/
valid users = tfox carole
writable = yes
create mask = 0765

El ejemplo de arriba permite a los usuarios tfox y carole leer y escribir en el directorio /home/share/, sobre el servidor Samba desde un cliente Samba.

Encrypted Passwords

Las contraseñas encriptadas están habilitadas por defecto puesto que es mas seguro usarlas. Para crear un usuario con una contraseña encriptada use la utilidad `smbpasswd:

smbpasswd -a username

Arrancando y Parando Samba

Para arrancar un servidor Samba, teclee el siguiente comando en el símbolo del sistema como root:

~]# systemctl start smb.service
Configurar un servidor miembro del dominio

Para configurar un servidor miembro del dominio usted debe primero unir el dominio o Active Directory usando el comando net join antes de arrancar el servicio smb. También, se recomienda correr winbind antes de smbd.

Para parar el servidor, teclee el siguiente comando en el símbolo del sistema como root:

~]# systemctl stop smb.service

La opción restart es una manera rápida de parar y seguidamente arrancar Samba. Es la manera más fiable de hacer que los cambios en la configuración tengan efecto después de haber editado el fichero de configuración de Samba. Note que la opción restart arranca el demonio aunque no estuviera corriendo originalmente.

Para reiniciar el servidor, teclee el siguiente comando en el símbolo del sistema como root:

~]# systemctl restart smb.service

La opción condrestart (reinicio condicional) solo arranca smb siempre que ya esté corriendo. Esta opción es útil para los scripts, puesto que no arranca el demonio si no está corriendo.

Aplicando los cambio a la configuración

Cuando se cambia el fichero /etc/samba/smb.conf Samba se recarga automáticamente después de unos pocos minutos. Enviar un restart o reload manual es igual de efectivo.

Para reiniciar condicionalmente el servidor, teclee el siguiente comando como root:

~]# systemctl try-restart smb.service

Una recarga manual del fichero /etc/samba/smb.conf puede ser útil en el caso de fallo en la recarga automática del servicio smb. Para asegurar que el fichero de configuración del servidor Samba se recarga sin reiniciar el servicio, teclee el siguiente comando como root:

~]# systemctl reload smb.service

Por defecto, el servicio smb no arranca automáticamente en el momento del arranque. Para configurar que Samba se inicie en el momento del arranque, teclee lo siguiente en el símbolo del sistema como root:

~]# systemctl enable smb.service

See Services and Daemons for more information regarding this tool.

Tipos de Servidor Samba y el Fichero smb.conf

La configuración de Samba es sencilla. Todas las modificaciones en Samba se hacen en el fichero de configuración /etc/samba/smb.conf. Aunque el fichero predeterminado smb.conf está bien documentado, no trata temas complejos como LDAP, Active Directory y las numerosas implementaciones de controladores de dominio.

Las siguientes secciones describen las diferentes maneras en las que puede ser configurado un servidor Samba. Tenga en cuenta sus necesidades y los cambios requeridos en el fichero /etc/samba/smb.conf para una configuración de éxito.

Stand-alone Server A stand-alone server can be a workgroup server or a member of a workgroup environment. A stand-alone server is not a domain controller and does not participate in a domain in any way. The following examples include several user-level security configurations. For more information on security modes, see Samba Security Modes.
Anonymous Read-Only

El siguiente fichero /etc/samba/smb.conf muestra un ejemplo de la configuración necesaria para implementar un recursos compartido de ficheros de solo lectura anónimo. Se usan dos directivas para configurar el acceso anónimo – map to guest = Bad user y guest account = nobody.

Ejemplo 2. Un Ejemplo de Configuración de una Servidor Samba de Solo Lectura Anónimo
[global]
workgroup = DOCS
netbios name = DOCS_SRV
security = user
guest account = nobody # default value
map to guest = Bad user

[data]
comment = Documentation Samba Server
path = /export
read only = yes
guest ok = yes
Anonymous Read/Write

El siguiente fichero /etc/samba/smb.conf muestra una configuración ejemplo necesaria para implementar una compartición de archivos lectura/escritura anónimo. Para habilitar la compartición de archivo lectura/escritura anónimo fije la directiva read only a no. Las directivas force user y force group se añaden también para forzar la propiedad de cualquiera de los ficheros nuevos especificados en el recurso compartido.

No use servidores de lectura/escritura anónimos

Aunque tener un servidor de lectura/escritura anónimo es posible, no se recomienda. Cualquier fichero situado en el espacio compartido, independientemente del usuario, es asignado a la combinación usuario/grupo como se especifica para un usuario (force user) y grupo (force group) genérico en el fichero /etc/samba/smb.conf.

Ejemplo 3. Un Ejemplo de Configuración de un Servidor Samba de Lectura/Escritura Anónimo
[global]
workgroup = DOCS
security = user
guest account = nobody # default value
map to guest = Bad user

[data]
comment = Data
path = /export
guest ok = yes
writeable = yes
force user = user
force group = group
Anonymous Print Server

El siguiente fichero /etc/samba/smb.conf muestra un ejemplo de la configuración necesaria para implementas un servidor de impresión anónimo. Ajustando browseable a no como se muestra no lista la impresora en el Entorno de Red de Windows. Aunque se oculte para la navegación, la configuración de la impresora explícitamente es posible. Conectando a DOCS_SRV usando NetBIOS, el cliente puede tener acceso a la impresota si el cliente es también parte del grupo de trabajo DOCS. Se asume también que el cliente tiene instalado el controlador correcto de la impresora local puesto que la directiva use client driver se ha fijado a yes. En este caso, el servidor Samba no tiene la responsabilidad de compartir los controladores de impresora con el cliente.

Ejemplo 4. Un Ejemplo de Configuración de una Servidor de Impresora Samba Anónimo
[global]
workgroup = DOCS
netbios name = DOCS_SRV
security = user
map to guest = Bad user
printing = cups

[printers]
comment = All Printers
path = /var/spool/samba
guest ok = yes
printable = yes
use client driver = yes
browseable = yes
Secure Read/Write File and Print Server

El siguiente fichero /etc/samba/smb.conf muestra un ejemplo de la configuración necesaria para implementar un servidor seguro de ficheros de lectura/escritura e impresión. Al fijar la directiva security a user fuerza a Samba a autenticar las conexiones del cliente. Dese cuenta que el recurso compartido [homes] no tiene directiva force user or`force group` como hace el recurso compartido [public]. El recurso compartido [homes] utiliza los detalles del usuario autenticado para cualquiera de los ficheros creados al contrario que force user y force group en [public].

Ejemplo 5. Un Ejemplo de Configuración de una Servidor Seguro Samba de Ficheros Lectura/Escritura e Impresión
[global]
workgroup = DOCS
netbios name = DOCS_SRV
security = user
printcap name = cups
disable spools = yes
show add printer wizard = no
printing = cups

[homes]
comment = Home Directories
valid users = %S
read only = no
browseable = no

[public]
comment = Data
path = /export
force user = docsbot
force group = users
guest ok = yes

[printers]
comment = All Printers
path = /var/spool/samba
printer admin = john, ed, @admins
create mask = 0600
guest ok = yes
printable = yes
use client driver = yes
browseable = yes
Domain Member Server A domain member, while similar to a stand-alone server, is logged into a domain controller (either Windows or Samba) and is subject to the domain’s security rules. An example of a domain member server would be a departmental server running Samba that has a machine account on the Primary Domain Controller (PDC). All of the department’s clients still authenticate with the PDC, and desktop profiles and all network policy files are included. The difference is that the departmental server has the ability to control printer and network shares.
Active Directory Domain Member Server

Para implementar un servidor miembro de dominio Active Directory, siga el procedimiento de abajo:

Añadir un Servidor Miembro a un Dominio Active Directory
  1. Cree el fichero de configuración /etc/samba/smb.conf sobre el servidor miembro a añadir al dominio Active Directory. Añada las siguientes líneas al fichero de configuración:

    [global]
    realm = EXAMPLE.COM
    security = ADS
    encrypt passwords = yes
    # Opcional. Usar solo si Samba no puede determinar el servidor Kerberos automáticamente.
    password server = kerberos.example.com

    Con la configuración de arriba, Samba autentica a los usuarios para los servicios que están corriendo localmente y también para un cliente del Active Directory. Asegure que su parámetro realm kerberos se muestra en mayúsculas (por ejemplo realm = EXAMPLE.COM). Como Windows 2000/2003/2008 requiere Kerberos para autenticación Active Directory, se requiere la directiva realm. Si Active Directory y Kerberos están corriendo servidores diferentes se requiere la directiva password server para ayudar a distinguirlos.

  2. Configure Kerberos sobre el servidor miembro. Cree el fichero de configuración /etc/krb5.conf con el siguiente contenido:

    [logging]
     default = FILE:/var/log/krb5libs.log
    
    [libdefaults]
     default_realm = AD.EXAMPLE.COM
     dns_lookup_realm = true
     dns_lookup_kdc = true
     ticket_lifetime = 24h
     renew_lifetime = 7d
     rdns = false
     forwardable = false
    
    [realms]
    # Definir solo si las búsquedas DNS no están trabajando
    # AD.EXAMPLE.COM = {
    #  kdc = server.ad.example.com
    #  admin_server = server.ad.example.com
    #  master_kdc = server.ad.example.com
    # }
    
    [domain_realm]
    # Definir solo si las búsquedas DNS no están trabajando
    # .ad.example.com = AD.EXAMPLE.COM
    # ad.example.com = AD.EXAMPLE.COM

    Quite el comentario de las secciones [realms] y [domain_realm] si las búsquedas DNS no están trabajando.

    Para más información sobre Kerberos y el fichero /etc/krb5.conf, vea la sección Usando Kerberos de la Red Hat Enterprise Linux  Guía de Autenticación de Sistema de Nivel 7.

  3. Para unir un servidor Active Directory, teclee el siguiente comando como root en el servidor miembro:

    ~]# net ads join -U administrator%password

    El comando net autentica como Administrador usando el protocolo Administrador NT LAN (NTLM) y crea la cuenta de la máquina. Después el net usa las credenciales de la cuenta de la máquina para autenticar con Kerberos.

    La opción seguridad

    Dado que utiliza security = ads y no security = user, no se necesita un back end de contraseña local como smbpasswd. Los clientes más antiguos que no tienen soporte de security = ads son autenticados como si se hubiera establecido security = domain. Este cambio no afecta funcionalmente y permite usuarios locales que no estaban anteriormente en el dominio.

Windows NT4-based Domain Member Server

El siguiente fichero /etc/samba/smb.conf muestra un ejemplo de la configuración necesaria para implementar un servidor miembro de dominio basado en Windows NT4. Llegar a ser un servidor miembro de un dominio basado en NT4 es similar a conectar a un Active Directory. La principal diferencia es que los dominios basados en NT4 no usan Kerberos en su método de autenticación, haciendo el fichero /etc/samba/smb.conf más simple. En este caso,el servidor miembro Samba funciona como un paso a través del servidor de dominio basado en NT4.

Ejemplo 6. Un Ejemplo de Configuración de una Servidor Miembro de Dominio Samba Basado en Windows NT4
[global]
workgroup = DOCS
netbios name = DOCS_SRV
security = domain

[homes]
comment = Home Directories
valid users = %S
read only = no
browseable = no

[public]
comment = Data
path = /export
force user = docsbot
force group = users
guest ok = yes

Tener Samba como un servidor miembro de dominio puede ser útil en muchas situaciones. Hay veces donde el servidor Samba puede tener otros usos más allá de compartir ficheros e impresoras. Puede ser beneficioso hacer un servidor miembro de dominio Samba en sitios donde se requieren aplicaciones solo Linux para usar en el entorno del dominio. Los administradores aprecian mantener rastro de todas las máquinas en el dominio aunque no sean basadas en Windows. En el caso de que el hardware del servidor basado en Windows quede obsoleto, es bastante fácil modificar el fichero /etc/samba/smb.conf para convertir el servidor a un PDC basado en Samba. Si los servidores basados en Windows NT son actualizados a Windows 2000/2003/2008 el fichero /etc/samba/smb.conf es fácilmente modificable para incorporar el cambio de infraestructura a Active Directory si es necesario.

Asegúrese de unirse al dominio antes de arrancar Samba

Después de configurar el fichero /etc/samba/smb.conf únase al dominio antes de arrancar Samba tecleando el siguiente comando como root:

~]# net rpc join -U administrator%password

Advierta que la opción -S,que especifica el nombre de host del servidor de dominio, no es necesario que sea indicada en el comando net rpc join. Samba usa el nombre de host especificado por la directiva workgroup en el fichero `/etc/samba/smb.conf`en lugar de que se indique explícitamente.

Domain Controller A domain controller in Windows NT is functionally similar to a Network Information Service (NIS) server in a Linux environment. Domain controllers and NIS servers both host user and group information databases as well as related services. Domain controllers are mainly used for security, including the authentication of users accessing domain resources. The service that maintains the user and group database integrity is called the Security Account Manager (SAM). The SAM database is stored differently between Windows and Linux Samba-based systems, therefore SAM replication cannot be achieved and platforms cannot be mixed in a PDC/BDC environment.

En un entorno Samba solo puede haber un PDC y cero o más BDCs.

Un entorno mezclado de controlador de dominio Samba/Windows

Samba no puede existir en un entorno de un controlador de dominio mixto Samba/Windows (Samba no puede ser un BDC de un PDC Windows o viceversa). Alternativamente pueden coexistir PDCs y BDCs Samba.

Controlador Primario de Domino (PDC) Usando tdbsam

La más común y sencilla implementación de Samba PDC utiliza, por defecto, el nuevo programa soporte de la base de datos de contraseñas tdbsam. Reemplazando al envejecido smbpasswd, tdbsam tiene numerosas mejoras que son explicadas en más detalle en Bases de Datos de Información de Cuenta Samba. La directiva passdb backend controla que programa de soporte será usado por el PDC.

El siguiente fichero /etc/samba/smb.conf enseña una configuración de muestra necesaria para implementar ek programa de soporte de base de datos de contraseñas tdbsam.

Ejemplo 7. Un Ejemplo de Configuración de Controlador Principal de Dominio (PDC) Usando tdbsam
[global]
workgroup = DOCS
netbios name = DOCS_SRV
passdb backend = tdbsam
security = user
add user script = /usr/sbin/useradd -m "%u"
delete user script = /usr/sbin/userdel -r "%u"
add group script = /usr/sbin/groupadd "%g"
delete group script = /usr/sbin/groupdel "%g"
add user to group script = /usr/sbin/usermod -G "%g" "%u"
add machine script = /usr/sbin/useradd -s /bin/false -d /dev/null  -g machines "%u"
# The following specifies the default logon script
# Per user logon scripts can be specified in the user
# account using pdbedit logon script = logon.bat
# This sets the default profile path.
# Set per user paths with pdbedit
logon drive = H:
domain logons = yes
os level = 35
preferred master = yes
domain master = yes

[homes]
	comment = Home Directories
	valid users = %S
	read only = no

[netlogon]
	comment = Network Logon Service
	path = /var/lib/samba/netlogon/scripts
	browseable = no
	read only = no
# For profiles to work, create a user directory under the
# path shown.
# mkdir -p /var/lib/samba/profiles/john

[Profiles]
	comment = Roaming Profile Share
	path = /var/lib/samba/profiles
	read only = no
	browseable = no
	guest ok = yes
	profile acls = yes
# Other resource shares ... ...

To provide a functional PDC system which uses tdbsam follow these steps:

  1. Adjust the smb.conf configuration file as shown in An Example Configuration of Primary Domain Controller (PDC) Using tdbsam.

  2. Add the root user to the Samba password database. You will be prompted to provide a new Samba password for the root user:

    ~]# smbpasswd -a root
    New SMB password:
  3. Start the smb service:

    ~]# service smb start
  4. Make sure all profile, user, and netlogon directories are created.

  5. Add groups that users can be members of:

    ~]# groupadd -f users
    ~]# groupadd -f nobody
    ~]# groupadd -f ntadmins
  6. Associate the UNIX groups with their respective Windows groups.

    ~]# net groupmap add ntgroup="Domain Users" unixgroup=users
    ~]# net groupmap add ntgroup="Domain Guests" unixgroup=nobody
    ~]# net groupmap add ntgroup="Domain Admins" unixgroup=ntadmins
  7. Grant access rights to a user or a group. For example, to grant the right to add client machines to the domain on a Samba domain controller, to the members to the Domain Admins group, execute the following command:

    ~]# net rpc rights grant 'DOCS\Domain Admins' SetMachineAccountPrivilege -S PDC -U root

Keep in mind that Windows systems prefer to have a primary group which is mapped to a domain group such as Domain Users.

Windows groups and users use the same namespace thus not allowing the existence of a group and a user with the same name like in UNIX.

Limitations of the tdbsam authentication back end

If you need more than one domain controller or have more than 250 users, do not use the tdbsam authentication back end. LDAP is recommended in these cases.

Primary Domain Controller (PDC) with Active Directory

Although it is possible for Samba to be a member of an Active Directory, it is not possible for Samba to operate as an Active Directory domain controller.

Samba Security Modes

There are only two types of security modes for Samba, share-level and user-level, which are collectively known as security levels. Share-level security is deprecated and has been removed from Samba. Configurations containing this mode need to be migrated to use user-level security. User-level security can be implemented in one of three different ways. The different ways of implementing a security level are called security modes.

User-Level Security User-level security is the default and recommended setting for Samba. Even if the security = user directive is not listed in the /etc/samba/smb.conf file, it is used by Samba. If the server accepts the client’s user name and password, the client can then mount multiple shares without specifying a password for each instance. Samba can also accept session-based user name and password requests. The client maintains multiple authentication contexts by using a unique UID for each logon.

In the /etc/samba/smb.conf file, the security = user directive that sets user-level security is:

[GLOBAL]
...
security = user
...
Samba Guest Shares

As mentioned above, share-level security mode is deprecated. To configure a Samba guest share without using the security = share parameter, follow the procedure below:

Configuring Samba Guest Shares
  1. Create a username map file, in this example /etc/samba/smbusers, and add the following line to it:

    nobody = guest
  2. Add the following directives to the main section in the /etc/samba/smb.conf file. Also, do not use the valid users directive:

    [GLOBAL]
    ...
    security = user
    map to guest = Bad User
    username map = /etc/samba/smbusers
    ...

    The username map directive provides a path to the username map file specified in the previous step.

  3. Add the following directive to the share section in the /ect/samba/smb.conf file. Do not use the valid users directive.

    [SHARE]
    ...
    guest ok = yes
    ...

The following sections describe other implementations of user-level security.

Domain Security Mode (User-Level Security)

In domain security mode, the Samba server has a machine account (domain security trust account) and causes all authentication requests to be passed through to the domain controllers. The Samba server is made into a domain member server by using the following directives in the /etc/samba/smb.conf file:

[GLOBAL]
...
security = domain
workgroup = MARKETING
...
Active Directory Security Mode (User-Level Security)

If you have an Active Directory environment, it is possible to join the domain as a native Active Directory member. Even if a security policy restricts the use of NT-compatible authentication protocols, the Samba server can join an ADS using Kerberos. Samba in Active Directory member mode can accept Kerberos tickets.

In the /etc/samba/smb.conf file, the following directives make Samba an Active Directory member server:

[GLOBAL]
...
security = ADS
realm = EXAMPLE.COM
password server = kerberos.example.com
...
Share-Level Security With share-level security, the server accepts only a password without an explicit user name from the client. The server expects a password for each share, independent of the user name. There have been recent reports that Microsoft Windows clients have compatibility issues with share-level security servers. This mode is deprecated and has been removed from Samba. Configurations containing security = share should be updated to use user-level security. Follow the steps in Configuring Samba Guest Shares to avoid using the security = share directive.
Samba Account Information Databases

The following is a list different back ends you can use with Samba. Other back ends not listed here may also be available.

Plain Text

Plain text back ends are nothing more than the /etc/passwd type back ends. With a plain text back end, all user names and passwords are sent unencrypted between the client and the Samba server. This method is very insecure and is not recommended for use by any means. It is possible that different Windows clients connecting to the Samba server with plain text passwords cannot support such an authentication method.

smbpasswd

The smbpasswd back end utilizes a plain ASCII text layout that includes the MS Windows LanMan and NT account, and encrypted password information. The smbpasswd back end lacks the storage of the Windows NT/2000/2003 SAM extended controls. The smbpasswd back end is not recommended because it does not scale well or hold any Windows information, such as RIDs for NT-based groups. The tdbsam back end solves these issues for use in a smaller database (250 users), but is still not an enterprise-class solution.

ldapsam_compat

The ldapsam_compat back end allows continued OpenLDAP support for use with upgraded versions of Samba.

tdbsam

The default tdbsam password back end provides a database back end for local servers, servers that do not need built-in database replication, and servers that do not require the scalability or complexity of LDAP. The tdbsam back end includes all of the smbpasswd database information as well as the previously-excluded SAM information. The inclusion of the extended SAM data allows Samba to implement the same account and system access controls as seen with Windows NT/2000/2003/2008-based systems.

The tdbsam back end is recommended for 250 users at most. Larger organizations should require Active Directory or LDAP integration due to scalability and possible network infrastructure concerns.

ldapsam

The ldapsam back end provides an optimal distributed account installation method for Samba. LDAP is optimal because of its ability to replicate its database to any number of servers such as the Red Hat Directory Server or an OpenLDAP Server. LDAP databases are light-weight and scalable, and as such are preferred by large enterprises. Installation and configuration of directory servers is beyond the scope of this chapter. For more information on the Red Hat Directory Server, see the Red Hat Directory Server 10 Deployment Guide. For more information on LDAP, see OpenLDAP.

If you are upgrading from a previous version of Samba to 3.0, note that the OpenLDAP schema file (/usr/share/doc/samba-version/LDAP/samba.schema) and the Red Hat Directory Server schema file (/usr/share/doc/samba-version/LDAP/samba-schema-FDS.ldif) have changed. These files contain the attribute syntax definitions and objectclass definitions that the ldapsam back end needs in order to function properly.

As such, if you are using the ldapsam back end for your Samba server, you will need to configure slapd to include one of these schema file. See Extending Schema for directions on how to do this.

Make sure the openldap-servers package is installed

You need to have the openldap-servers package installed if you want to use the ldapsam back end. To ensure that the package is installed, execute the following command as roots:

~]# dnf install openldap-servers
Samba Network Browsing

Network browsing enables Windows and Samba servers to appear in the Windows Network Neighborhood. Inside the Network Neighborhood, icons are represented as servers and if opened, the server’s shares and printers that are available are displayed.

Network browsing capabilities require NetBIOS over TCP/IP. NetBIOS-based networking uses broadcast (UDP) messaging to accomplish browse list management. Without NetBIOS and WINS as the primary method for TCP/IP host name resolution, other methods such as static files (/etc/hosts) or DNS, must be used.

A domain master browser collates the browse lists from local master browsers on all subnets so that browsing can occur between workgroups and subnets. Also, the domain master browser should preferably be the local master browser for its own subnet.

Domain Browsing By default, a Windows server PDC for a domain is also the domain master browser for that domain. A Samba server must not be set up as a domain master server in this type of situation.

For subnets that do not include the Windows server PDC, a Samba server can be implemented as a local master browser. Configuring the /etc/samba/smb.conf file for a local master browser (or no browsing at all) in a domain controller environment is the same as workgroup configuration (see Configuring a Samba Server).

WINS (Windows Internet Name Server) Either a Samba server or a Windows NT server can function as a WINS server. When a WINS server is used with NetBIOS enabled, UDP unicasts can be routed which allows name resolution across networks. Without a WINS server, the UDP broadcast is limited to the local subnet and therefore cannot be routed to other subnets, workgroups, or domains. If WINS replication is necessary, do not use Samba as your primary WINS server, as Samba does not currently support WINS replication.

In a mixed NT/2000/2003/2008 server and Samba environment, it is recommended that you use the Microsoft WINS capabilities. In a Samba-only environment, it is recommended that you use only one Samba server for WINS.

The following is an example of the /etc/samba/smb.conf file in which the Samba server is serving as a WINS server:

Ejemplo 8. An Example Configuration of WINS Server
[global]
wins support = yes
Using WINS

All servers (including Samba) should connect to a WINS server to resolve NetBIOS names. Without WINS, browsing only occurs on the local subnet. Furthermore, even if a domain-wide list is somehow obtained, hosts cannot be resolved for the client without WINS.

Samba with CUPS Printing Support

Samba allows client machines to share printers connected to the Samba server. In addition, Samba also allows client machines to send documents built in Linux to Windows printer shares. Although there are other printing systems that function with Fedora, CUPS (Common UNIX Print System) is the recommended printing system due to its close integration with Samba.

Simple smb.conf Settings The following example shows a very basic /etc/samba/smb.conf configuration for CUPS support:
Ejemplo 9. An Example Configuration of Samba with CUPS Support
[global]
load printers = yes
printing = cups
printcap name = cups
[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
guest ok = yes
writable = no
printable = yes
printer admin = @ntadmins
[print$]
comment = Printer Drivers Share
path = /var/lib/samba/drivers
write list = ed, john
printer admin = ed, john

Other printing configurations are also possible. To add additional security and privacy for printing confidential documents, users can have their own print spooler not located in a public path. If a job fails, other users would not have access to the file.

The print$ directive contains printer drivers for clients to access if not available locally. The print$ directive is optional and may not be required depending on the organization.

Setting browseable to yes enables the printer to be viewed in the Windows Network Neighborhood, provided the Samba server is set up correctly in the domain or workgroup.

Samba Distribution Programs

.net

net <protocol> <function> <misc_options> <target_options>

The net utility is similar to the net utility used for Windows and MS-DOS. The first argument is used to specify the protocol to use when executing a command. The protocol option can be ads, rap, or rpc for specifying the type of server connection. Active Directory uses ads, Win9x/NT3 uses rap, and Windows NT4/2000/2003/2008 uses rpc. If the protocol is omitted, net automatically tries to determine it.

The following example displays a list of the available shares for a host named wakko:

~]$ net -l share -S wakko
Password:
Enumerating shared resources (exports) on remote server:
Share name   Type     Description
----------   ----     -----------
data         Disk     Wakko data share
tmp          Disk     Wakko tmp share
IPC$         IPC      IPC Service (Samba Server)
ADMIN$       IPC      IPC Service (Samba Server)

The following example displays a list of Samba users for a host named wakko:

~]$ net -l user -S wakko
root password:
User name             Comment
-----------------------------
andriusb              Documentation
joe                   Marketing
lisa                  Sales
nmblookup
nmblookup <options> <netbios_name>

The nmblookup program resolves NetBIOS names into IP addresses. The program broadcasts its query on the local subnet until the target machine replies.

The following example displays the IP address of the NetBIOS name trek:

~]$ nmblookup trek querying trek on 10.1.59.255 10.1.56.45 trek<00>
pdbedit
pdbedit <options>

The pdbedit program manages accounts located in the SAM database. All back ends are supported including smbpasswd, LDAP, and the tdb database library.

The following are examples of adding, deleting, and listing users:

~]$ pdbedit -a kristin
new password:
retype new password:
Unix username:        kristin
NT username:
Account Flags:        [U          ]
User SID:             S-1-5-21-1210235352-3804200048-1474496110-2012
Primary Group SID:    S-1-5-21-1210235352-3804200048-1474496110-2077
Full Name: Home Directory:       \\wakko\kristin
HomeDir Drive:
Logon Script:
Profile Path:         \\wakko\kristin\profile
Domain:               WAKKO
Account desc:
Workstations: Munged
dial:
Logon time:           0
Logoff time:          Mon, 18 Jan 2038 22:14:07 GMT
Kickoff time:         Mon, 18 Jan 2038 22:14:07 GMT
Password last set:    Thu, 29 Jan 2004 08:29:28
GMT Password can change:  Thu, 29 Jan 2004 08:29:28 GMT
Password must change: Mon, 18 Jan 2038 22:14:07 GMT
~]$ pdbedit -v -L kristin
Unix username:        kristin
NT username:
Account Flags:        [U          ]
User SID:             S-1-5-21-1210235352-3804200048-1474496110-2012
Primary Group SID:    S-1-5-21-1210235352-3804200048-1474496110-2077
Full Name:
Home Directory:       \\wakko\kristin
HomeDir Drive:
Logon Script:
Profile Path:         \\wakko\kristin\profile
Domain:               WAKKO
Account desc:
Workstations: Munged
dial:
Logon time:           0
Logoff time:          Mon, 18 Jan 2038 22:14:07 GMT
Kickoff time:         Mon, 18 Jan 2038 22:14:07 GMT
Password last set:    Thu, 29 Jan 2004 08:29:28 GMT
Password can change:  Thu, 29 Jan 2004 08:29:28 GMT
Password must change: Mon, 18 Jan 2038 22:14:07 GMT
~]$ pdbedit -L
andriusb:505:
joe:503:
lisa:504:
kristin:506:
~]$ pdbedit -x joe
~]$ pdbedit -L
andriusb:505: lisa:504: kristin:506:
rpcclient
rpcclient <server> <options>

The rpcclient program issues administrative commands using Microsoft RPCs, which provide access to the Windows administration graphical user interfaces (GUIs) for systems management. This is most often used by advanced users that understand the full complexity of Microsoft RPCs.

smbcacls
smbcacls <//server/share> <filename> <options>

The smbcacls program modifies Windows ACLs on files and directories shared by a Samba server or a Windows server.

smbclient
smbclient <//server/share> <password> <options>

The smbclient program is a versatile UNIX client which provides functionality similar to the ftp utility.

smbcontrol
smbcontrol -i <options>
smbcontrol <options> <destination> <messagetype> <parameters>

The smbcontrol program sends control messages to running smbd, nmbd, or winbindd daemons. Executing smbcontrol -i runs commands interactively until a blank line or a 'q' is entered.

smbpasswd
smbpasswd <options> <username> <password>

The smbpasswd program manages encrypted passwords. This program can be run by a superuser to change any user’s password and also by an ordinary user to change their own Samba password.

smbspool
smbspool <job> <user> <title> <copies> <options> <filename>

The smbspool program is a CUPS-compatible printing interface to Samba. Although designed for use with CUPS printers, smbspool can work with non-CUPS printers as well.

smbstatus
smbstatus <options>

The smbstatus program displays the status of current connections to a Samba server.

smbtar
smbtar <options>

The smbtar program performs backup and restores of Windows-based share files and directories to a local tape archive. Though similar to the tar utility, the two are not compatible.

testparm
testparm <options> <filename> <hostname IP_address>

The testparm program checks the syntax of the /etc/samba/smb.conf file. If your smb.conf file is in the default location (/etc/samba/smb.conf) you do not need to specify the location. Specifying the host name and IP address to the testparm program verifies that the hosts.allow and host.deny files are configured correctly. The testparm program also displays a summary of your smb.conf file and the server’s role (stand-alone, domain, etc.) after testing. This is convenient when debugging as it excludes comments and concisely presents information for experienced administrators to read. For example:

~]$ testparm Load smb config files from /etc/samba/smb.conf Processing section "[homes]" Processing section "[printers]" Processing section "[tmp]" Processing section "[html]" Loaded services file OK. Server role: ROLE_STANDALONE Press enter to see a dump of your service definitions <enter> # Global parameters
[global]
	workgroup = MYGROUP
	server string = Samba Server
	security = SHARE
	log file = /var/log/samba/%m.log
	max log size = 50
	socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
	dns proxy = no
[homes]
	comment = Home Directories
	read only = no
	browseable = no
[printers]
	comment = All Printers
	path = /var/spool/samba
	printable = yes
	browseable = no
[tmp]
	comment = Wakko tmp
	path = /tmp
	guest only = yes
[html]
	comment = Wakko www
	path = /var/www/html
	force user = andriusb
	force group = users
	read only = no
	guest only = yes
wbinfo
wbinfo <options>

The wbinfo program displays information from the winbindd daemon. The winbindd daemon must be running for wbinfo to work.

Recursos Adicionales

The following sections give you the means to explore Samba in greater detail.

Installed Documentation
  • /usr/share/doc/samba-<version-number>/ — All additional files included with the Samba distribution. This includes all helper scripts, sample configuration files, and documentation.

  • See the following man pages for detailed information specific Samba features:

    • smb.conf(5)

    • samba(7)

    • smbd(8)

    • nmbd(8)

    • winbindd(8)

Useful Websites
  • http://www.samba.org/ — Homepage for the Samba distribution and all official documentation created by the Samba development team. Many resources are available in HTML and PDF formats, while others are only available for purchase. Although many of these links are not Fedora specific, some concepts may apply.

  • https://wiki.samba.org/index.php/User_Documentation — Samba 4.x official documentation.

  • http://samba.org/samba/archives.html — Active email lists for the Samba community. Enabling digest mode is recommended due to high levels of list activity.

  • Samba newsgroups — Samba threaded newsgroups, such as www.gmane.org, that use the NNTP protocol are also available. This an alternative to receiving mailing list emails.

FTP

Protocolo de Transferencia de Ficheros (FTP) es uno de los protocolos más antiguos y más usados en Internet hoy. Su propósito es transferir con seguridad ficheros entre ordenadores de una red sin requerir que el usuario acceda directamente al host remoto o sin que se tenga que tener conocimiento de como usar el sistema remoto. Permite a los usuarios acceder a ficheros en los sistemas remotos usando un conjunto estándar de sencillos comandos.

Esta sección describe los conceptos básicos del protocolo FTP, así como las opciones de configuración para el servidor primario `FTP`enviado con Fedora, vsftpd.

El Protocolo de Transferencia de Ficheros

Sin embargo, puesto que FTP es tan frecuente en Internet, a menudo se requiere compartir ficheros con el público. Los administradores de sistema, por lo tanto, deben conocer las características únicas del protocolo FTP.

A diferencia de la mayoría de protocolos que se emplean en Internet, FTP requiere la utilización de varios puertos de red para funcionar adecuadamente. Cuando una aplicación cliente de FTP inicia una conexión a un servidor FTP, abre el puerto 21 en este, el conocido como puerto de órdenes. Este puerto sirve para emitir todas las órdenes que van hacia el servidor. Cualesquier datos solicitados desde el servidor se devuelven al cliente a través de un puerto de datos. El número de puerto para las conexiones de datos, así como la manera en que se inician las conexiones de datos, varían en función del modo en que el cliente solicita los datos: activa o pasivamente.

A continuación se definen estos modos:

modo activo

El modo activo es el método original utilizado por el protocolo FTP para transferir datos a la aplicación cliente. Cuando el cliente FTP inicia una transferencia de datos en modo activo, el servidor abre una conexión desde su puerto 20 hacia la dirección IP y un puerto no privilegiado al azar (mayor que 1024) especificado por el cliente. Este mecanismo implica que a la máquina cliente debe permitírsele aceptar conexiones en cualquier puerto superior a 1024. Con el auge de las redes no seguras como Internet, ahora es extendida la utilización de cortafuegos para proteger las máquinas cliente. Como estos cortafuegos de lado cliente a menudo rechazan las conexiones entrantes provenientes de servidores FTP en modo activo, se ideó el modo pasivo.

modo pasivo

El modo pasivo, como el activo, lo inicia la aplicación cliente de FTP. Al solicitar datos del servidor, el cliente FTP indica que quiere acceder a los datos en modo pasivo y el servidor brinda la dirección IP y un puerto no privilegiado al azar (mayor que 1024) en el servidor. El cliente se conecta en ese puerto del servidor para descargar la información solicitada.

Aunque el modo pasivo da solución a diversos problemas de interferencia por cortafuegos en el lado cliente con conexiones de datos, puede complicar la administración del cortafuegos de lado servidor. Puede disminuir la cantidad de puertos abiertos de un servidor si limita el intervalo de puertos no privilegiados del servidor FTP. Esto a su vez simplifica el proceso de configuración de reglas para el cortafuegos del servidor. Consulte Opciones de red para obtener más información sobre limitar los puertos pasivos.

Servidores FTP

Fedora incluye dos servidores FTP diferentes:

  • proftpd: un servidor FTP rápido, estable y altamente configurable.

  • vsftpd: Un demonio FTP rápido y seguro, que es la opción preferida de servidor FTP para Fedora. El resto de esta sección se dedica a describir vsftpd.

vsftpd

El Demonio FTP Muy Seguro (vsftpd) esta diseñado desde cero para ser rápido, estable y, lo más importante, seguro. vsftpd es el único servidor FTP independiente distribuido con Fedora, debido a su capacidad para manejar un gran número de conexiones de manera eficiente y segura.

El modelo de seguridad usado por vsftpd tiene tres aspecto principales:

  • Fuerte separación de procesos privilegiados y no privilegiados — Los procesos separados manejan diferentes tareas y cada uno de los procesos se ejecuta con los privilegios mínimos requeridos por la tarea.

  • Las tareas que requieren privilegios elevados con manejadas por procesos con los mínimos privilegios necesarios — Aprovechando las compatibilidades encontradas en la librería libcap, las tareas que normalmente necesitan privilegios completos de root pueden ser ejecutadas con mayor seguridad desde procesos con menos privilegios.

  • La mayoría de los procesos se ejecutan en una jaula chroot — Siempre que sea posible los procesos cambian de raíz al directorio que se comparte; este directorio es considerado entonces una jaula chroot. Por ejemplo, si el directorio /var/ftp/ es el directorio compartido primario, vsftpd reasigna /var/ftp/ al nuevo directorio raíz, conocido como /. Esto deshabilita cualquier potencial actividad maliciosa de un hacker en cualquier directorio que no esté contenido bajo el nuevo directorio raíz.

El uso de esta prácticas de seguridad tienen el siguiente efecto sobre como vsftpd trata con las peticiones:

  • El proceso padre corre con los mínimos privilegios requeridos — El proceso padre calcula dinámicamente el nivel de privilegios que se requiere para minimizar el nivel de riesgo. Los procesos hijos manejan la interacción directa con los clientes FTP y se ejecutan casi sin privilegios si es posible.

  • Todas las operaciones que requieran privilegios elevados son manejadas por pequeños procesos padre — Al igual que el Servidor HTTP Apache, vsftpd lanza procesos hijo sin privilegios para manejar las conexiones entrantes. Estos permite que los procesos padre con privilegios sean tan pequeños como sea posible para manejar relativamente pocas tareas.

  • Todas las peticiones desde procesos hijo sin privilegios son distribuidas por los procesos padre — Las comunicaciones con los procesos hijos son recibidas por un socket y se comprueba la validez de cualquier información de los procesos hijo antes de actuar.

  • La mayoría de la interacción con los clientes FTP es manejada por procesos hijo sin privilegios en una jaula chroot — Como estos procesos hijo no tienen privilegios y solo tiene acceso al directorio que está siendo compartido, cualquier proceso que falle solo permite al atacante el acceso a los ficheros compartidos.

Ficheros instalados con vsftpd

El RPM vsftpd instala el demonio (/usr/sbin/vsftpd), su configuración y ficheros relacionados así como los directorios FTP sobre el sistema. A continuación se listan los ficheros y directorios relacionados con la configuración de vsftpd:

  • /etc/rc.d/init.d/vsftpd — El script de inicializacion (initscript) usado por el comando systemctl para arrancar, parar y reiniciar vsftpd. Vea Arrancando y Parando vsftpd para mas información sobre el uso de este script.

  • /etc/pam.d/vsftpd — El fichero de configuración de los Módulos de Autenticación Conectables (PAM) para vsftpd. Este fichero especifica los requisitos que un usuario debe tener para acceder al servidor FTP. Para más información sobre PAM, vea la guía Using Pluggable Authentication Modules (PAM) chapter of the Fedora 26 [citetitle]_Managing Single Sign-On and Smart Cards.

  • /etc/vsftpd/vsftpd.conf — El archivo de configuración para vsftpd. Vea en vsftpd Opciones de Configuración una lista de importantes opciones contenidas en este archivo.

  • /etc/vsftpd/ftpusers — Una lista de los usuarios a los que no está permitido acceder a vsftpd. De forma predeterminada, esta lista incluye los usuarios root, bin y daemon, entre otros.

  • /etc/vsftpd/user_list — Este archivo puede ser configurado para denegar o permitir el acceso a los usuarios listados, dependiendo de si la directiva userlist_deny esta establecida en YES (predeterminado) o NO en /etc/vsftpd/vsftpd.conf. Si se usa /etc/vsftpd/user_list para conceder acceso a usuarios, los nombres de usuarios listados no deben aparecer en /etc/vsftpd/ftpusers.

  • /var/ftp/ — El directorio que contiene los archivos servidos por vsftpd. También contiene el directorio /var/ftp/pub/ para los usuarios anónimos. Ambos directorios deben ser legibles por todo el mundo, pero solo editables por el usuario root.

Arrancando y Parando vsftpd

El RPM vsftpd instala el script /etc/rc.d/init.d/vsftpd al que se puede acceder usando el comando systemctl.

Para arrancar el servidor, como root teclee:

systemctl start vsftpd.service

Para parar el servidor, como root teclee:

systemctl stop vsftpd.service

La opción restart es un atajo para parar y después arrancar vsftpd. Esta es la forma más eficiente de hacer que los cambios de configuración tomen efecto después de editar el archivo de configuración de vsftpd.

Para reiniciar el servidor, como root teclee:

systemctl restart vsftpd.service

La opción condrestart (reinicio condicional) arranca vsftpd solo si está corriendo en este momento. Esta opción es útil para scripts, puesto que no arranca el demonio si no está corriendo.

Para reiniciar condicionalmente el servidor, como root teclee:

systemctl condrestart vsftpd.service

De modo predeterminado, el servicio vsftpd no se inicia automáticamente en el momento del arranque. Para configurar que el servicio vsftpd se inicie en el momento del arranque, utilice un administrador de servicios como systemctl. Vea en Servicios y Demonios más información sobre configurar servicios en Fedora.

Iniciando Múltiples Copias de vsftpd Alguna veces un ordenador se utiliza para servir múltiples dominios FTP. Esta es una técnica llamada multiconexión. Una manera de hacerlo usando vsftpd es corriendo múltiples copias del demonio, cada una con su propio archivo de configuración.

Para hacer esto, primero asigne todas las direcciones IP relevantes a dispositivos de red o alias de dispositivo de red en el sistema. Para más información sobre la configuración de los dispositivos de red, los alias de dispositivos e información adicional sobre los scripts de configuración de red vea la Guía de Red Fedora.

A continuación, se debe configurar el servidor DNS para los dominios FTP para referirlos a la maquina correcta. Para información sobre BIND y sus archivos de configuración vea la [citetitle]_Guía de Red Fedora.

Si hay mas archivos de configuración presentes en el directorio /etc/vsftpd, llamando a systemctl start vsftpd.service consigue que el initscript de /etc/rc.d/init.d/vsftpd inicie el mismo número de procesos que archivos de configuración. Cada archivo de configuración debe tener un nombre único en el directorio /etc/vsftpd/ y debe ser de escritura y de lectura solo para root.

Opciones de Configuración de vsftpd

Aunque vsftpd puede no ofrecer el nivel de personalización que otros servidores FTP ampliamente disponibles tienen, ofrece bastantes opciones que llenan las necesidades de la mayoría de los administradores. El hecho de que no esté demasiado cargado de funciones limita la configuración y los errores de programación.

Toda la configuración de vsftpd se maneja por su archivo de configuración , /etc/vsftpd/vsftpd.conf. Cada directiva tiene su propia línea dentro del archivo y sigue el siguiente formato:

directive=value

For each directive, replace directive with a valid directive and value with a valid value.

No utilice espacios

There must not be any spaces between the directive, equal symbol, and the value in a directive.

Comment lines must be preceded by a hash sign (#) and are ignored by the daemon.

For a complete list of all directives available, refer to the man page for vsftpd.conf.

Securing the vsftpd service

For an overview of ways to secure vsftpd, see the Red Hat Enterprise Linux 7 Security Guide.

La siguiente es una lista de algunas de las directivas más importantes incluidas en /etc/vsftpd/vsftpd.conf. Cualesquier directivas que no se encuentren explícitamente en el archivo de configuración de vsftpd se establecen a su valor predeterminado.

Daemon Options The following is a list of directives which control the overall behavior of the vsftpd daemon.
  • listen — When enabled, vsftpd runs in stand-alone mode. Fedora sets this value to YES. This directive cannot be used in conjunction with the listen_ipv6 directive.

    El valor predeterminado es NO.

  • listen_ipv6 — When enabled, vsftpd runs in stand-alone mode, but listens only to IPv6 sockets. This directive cannot be used in conjunction with the listen directive.

    El valor predeterminado es NO.

  • session_support — When enabled, vsftpd attempts to maintain login sessions for each user through Pluggable Authentication Modules (PAM). For more information, refer to the Using Pluggable Authentication Modules (PAM) chapter of the Red Hat Enterprise Linux 6 Managing Single Sign-On and Smart Cards and the PAM man pages. . If session logging is not necessary, disabling this option allows vsftpd to run with less processes and lower privileges.

    El valor predeterminado es YES.

Log In Options and Access Controls The following is a list of directives which control the login behavior and access control mechanisms.
  • anonymous_enable — When enabled, anonymous users are allowed to log in. The usernames anonymous and ftp are accepted.

    El valor predeterminado es YES.

    See Anonymous User Options for a list of directives affecting anonymous users.

  • banned_email_file — If the deny_email_enable directive is set to YES, this directive specifies the file containing a list of anonymous email passwords which are not permitted access to the server.

    El valor predeterminado es /etc/vsftpd/banned_emails.

  • banner_file — Specifies the file containing text displayed when a connection is established to the server. This option overrides any text specified in the ftpd_banner directive.

    No hay ningún valor predeterminado para esta directiva.

  • cmds_allowed — Specifies a comma-delimited list of FTP commands allowed by the server. All other commands are rejected.

    No hay ningún valor predeterminado para esta directiva.

  • deny_email_enable — When enabled, any anonymous user utilizing email passwords specified in the /etc/vsftpd/banned_emails are denied access to the server. The name of the file referenced by this directive can be specified using the banned_email_file directive.

    El valor predeterminado es NO.

  • ftpd_banner — When enabled, the string specified within this directive is displayed when a connection is established to the server. This option can be overridden by the banner_file directive.

    By default vsftpd displays its standard banner.

  • local_enable — When enabled, local users are allowed to log into the system.

    El valor predeterminado es YES.

    See Local User Options for a list of directives affecting local users.

  • pam_service_name — Specifies the PAM service name for vsftpd.

    El valor predeterminado es ftp. Observe que, en Fedora, el valor se establece a vsftpd.

  • El valor predeterminado es NO. Observe que, en Fedora, el valor se establece a YES.

  • userlist_deny — When used in conjunction with the userlist_enable directive and set to NO, all local users are denied access unless the username is listed in the file specified by the userlist_file directive. Because access is denied before the client is asked for a password, setting this directive to NO prevents local users from submitting unencrypted passwords over the network.

    El valor predeterminado es YES.

  • userlist_enable — When enabled, the users listed in the file specified by the userlist_file directive are denied access. Because access is denied before the client is asked for a password, users are prevented from submitting unencrypted passwords over the network.

    El valor predeterminado es NO; sin embargo, en Fedora el valor se establece a YES.

  • userlist_file — Specifies the file referenced by vsftpd when the userlist_enable directive is enabled.

    El valor predeterminado es /etc/vsftpd/user_list y se crea durante la instalación.

Anonymous User Options The following lists directives which control anonymous user access to the server. To use these options, the anonymous_enable directive must be set to YES.
  • anon_mkdir_write_enable — When enabled in conjunction with the write_enable directive, anonymous users are allowed to create new directories within a parent directory which has write permissions.

    El valor predeterminado es NO.

  • anon_root — Specifies the directory vsftpd changes to after an anonymous user logs in.

    No hay ningún valor predeterminado para esta directiva.

  • anon_upload_enable — When enabled in conjunction with the write_enable directive, anonymous users are allowed to upload files within a parent directory which has write permissions.

    El valor predeterminado es NO.

  • anon_world_readable_only — When enabled, anonymous users are only allowed to download world-readable files.

    El valor predeterminado es YES.

  • ftp_username — Specifies the local user account (listed in /etc/passwd) used for the anonymous FTP user. The home directory specified in /etc/passwd for the user is the root directory of the anonymous FTP user.

    El valor predeterminado es ftp.

  • no_anon_password — When enabled, the anonymous user is not asked for a password.

    El valor predeterminado es NO.

  • secure_email_list_enable — When enabled, only a specified list of email passwords for anonymous logins are accepted. This is a convenient way to offer limited security to public content without the need for virtual users.

    Anonymous logins are prevented unless the password provided is listed in /etc/vsftpd/email_passwords. The file format is one password per line, with no trailing white spaces.

    El valor predeterminado es NO.

Local User Options The following lists directives which characterize the way local users access the server. To use these options, the local_enable directive must be set to YES.
  • chmod_enable — When enabled, the FTP command SITE CHMOD is allowed for local users. This command allows the users to change the permissions on files.

    El valor predeterminado es YES.

  • chroot_list_enable — When enabled, the local users listed in the file specified in the chroot_list_file directive are placed in a chroot jail upon log in.

    If enabled in conjunction with the chroot_local_user directive, the local users listed in the file specified in the chroot_list_file directive are not placed in a chroot jail upon log in.

    El valor predeterminado es NO.

  • chroot_list_file — Specifies the file containing a list of local users referenced when the chroot_list_enable directive is set to YES.

    El valor predeterminado es /etc/vsftpd/chroot_list.

  • chroot_local_user — When enabled, local users are change-rooted to their home directories after logging in.

    El valor predeterminado es NO.

    Avoid enabling the chroot_local_user option

    Enabling chroot_local_user opens up a number of security issues, especially for users with upload privileges. For this reason, it is not recommended.

  • guest_enable — When enabled, all non-anonymous users are logged in as the user guest, which is the local user specified in the guest_username directive.

    El valor predeterminado es NO.

  • guest_username — Specifies the username the guest user is mapped to.

    El valor predeterminado es ftp.

  • local_root — Specifies the directory vsftpd changes to after a local user logs in.

    No hay ningún valor predeterminado para esta directiva.

  • local_umask: especifica el valor de «umask» para la creación de archivos. Observe que el valor predeterminado se encuentra en forma octal (un sistema numérico cuya base es ocho) e incluye el prefijo «0». En caso contrario, el valor se trata como un entero de base 10.

    El valor predeterminado es 022.

  • passwd_chroot_enable — When enabled in conjunction with the chroot_local_user directive, vsftpd change-roots local users based on the occurrence of the /./ in the home directory field within /etc/passwd.

    El valor predeterminado es NO.

  • user_config_dir — Specifies the path to a directory containing configuration files bearing the name of local system users that contain specific setting for that user. Any directive in the user’s configuration file overrides those found in /etc/vsftpd/vsftpd.conf.

    No hay ningún valor predeterminado para esta directiva.

Directory Options The following lists directives which affect directories.
  • dirlist_enable — When enabled, users are allowed to view directory lists.

    El valor predeterminado es YES.

  • dirmessage_enable — When enabled, a message is displayed whenever a user enters a directory with a message file. This message resides within the current directory. The name of this file is specified in the message_file directive and is .message by default.

    El valor predeterminado es NO. Observe que, en Fedora, el valor se establece a YES.

  • force_dot_files — When enabled, files beginning with a dot (.) are listed in directory listings, with the exception of the . and .. files.

    El valor predeterminado es NO.

  • hide_ids — When enabled, all directory listings show ftp as the user and group for each file.

    El valor predeterminado es NO.

  • message_file — Specifies the name of the message file when using the dirmessage_enable directive.

    El valor predeterminado es .message.

  • text_userdb_names — When enabled, text usernames and group names are used in place of UID and GID entries. Enabling this option may slow performance of the server.

    El valor predeterminado es NO.

  • use_localtime — When enabled, directory listings reveal the local time for the computer instead of GMT.

    El valor predeterminado es NO.

File Transfer Options The following lists directives which affect directories.
  • download_enable — When enabled, file downloads are permitted.

    El valor predeterminado es YES.

  • chown_uploads — When enabled, all files uploaded by anonymous users are owned by the user specified in the chown_username directive.

    El valor predeterminado es NO.

  • chown_username — Specifies the ownership of anonymously uploaded files if the chown_uploads directive is enabled.

    El valor predeterminado es root.

  • write_enable — When enabled, FTP commands which can change the file system are allowed, such as DELE, RNFR, and STOR.

    El valor predeterminado es YES.

Logging Options The following lists directives which affect vsftpd's logging behavior.
  • dual_log_enable — When enabled in conjunction with xferlog_enable, vsftpd writes two files simultaneously: a wu-ftpd-compatible log to the file specified in the xferlog_file directive (/var/log/xferlog by default) and a standard vsftpd log file specified in the vsftpd_log_file directive (/var/log/vsftpd.log by default).

    El valor predeterminado es NO.

  • log_ftp_protocol — When enabled in conjunction with xferlog_enable and with xferlog_std_format set to NO, all FTP commands and responses are logged. This directive is useful for debugging.

    El valor predeterminado es NO.

  • syslog_enable — When enabled in conjunction with xferlog_enable, all logging normally written to the standard vsftpd log file specified in the vsftpd_log_file directive (/var/log/vsftpd.log by default) is sent to the system logger instead under the FTPD facility.

    El valor predeterminado es NO.

  • vsftpd_log_file — Specifies the vsftpd log file. For this file to be used, xferlog_enable must be enabled and xferlog_std_format must either be set to NO or, if xferlog_std_format is set to YES, dual_log_enable must be enabled. It is important to note that if syslog_enable is set to YES, the system log is used instead of the file specified in this directive.

    El valor predeterminado es /var/log/vsftpd.log.

  • xferlog_enable — When enabled, vsftpd logs connections (vsftpd format only) and file transfer information to the log file specified in the vsftpd_log_file directive (/var/log/vsftpd.log by default). If xferlog_std_format is set to YES, file transfer information is logged but connections are not, and the log file specified in xferlog_file (/var/log/xferlog by default) is used instead. It is important to note that both log files and log formats are used if dual_log_enable is set to YES.

    El valor predeterminado es NO. Observe que, en Fedora, el valor se establece a YES.

  • xferlog_file — Specifies the wu-ftpd-compatible log file. For this file to be used, xferlog_enable must be enabled and xferlog_std_format must be set to YES. It is also used if dual_log_enable is set to YES.

    El valor predeterminado es /var/log/xferlog.

  • xferlog_std_format — When enabled in conjunction with xferlog_enable, only a wu-ftpd-compatible file transfer log is written to the file specified in the xferlog_file directive (/var/log/xferlog by default). It is important to note that this file only logs file transfers and does not log connections to the server.

    El valor predeterminado es NO. Observe que, en Fedora, el valor se establece a YES.

Mantener la compatibilidad con formatos de archivo de registro anteriores

To maintain compatibility with log files written by the older wu-ftpd FTP server, the xferlog_std_format directive is set to YES under Fedora. However, this setting means that connections to the server are not logged.

To both log connections in vsftpd format and maintain a wu-ftpd-compatible file transfer log, set dual_log_enable to YES.

If maintaining a wu-ftpd-compatible file transfer log is not important, either set xferlog_std_format to NO, comment the line with a hash sign (#), or delete the line entirely.

Network Options The following lists directives which affect how vsftpd interacts with the network.
  • accept_timeout — Specifies the amount of time for a client using passive mode to establish a connection.

    El valor predeterminado es 60.

  • anon_max_rate — Specifies the maximum data transfer rate for anonymous users in bytes per second.

    El valor predeterminado es 0, el cual no limita la tasa de transferencia.

  • connect_from_port_20 When enabled, vsftpd runs with enough privileges to open port 20 on the server during active mode data transfers. Disabling this option allows vsftpd to run with less privileges, but may be incompatible with some FTP clients.

    El valor predeterminado es NO. Observe que, en Fedora, el valor se establece a YES.

  • connect_timeout — Specifies the maximum amount of time a client using active mode has to respond to a data connection, in seconds.

    El valor predeterminado es 60.

  • data_connection_timeout — Specifies maximum amount of time data transfers are allowed to stall, in seconds. Once triggered, the connection to the remote client is closed.

    El valor predeterminado es 300.

  • ftp_data_port — Specifies the port used for active data connections when connect_from_port_20 is set to YES.

    El valor predeterminado es 20.

  • idle_session_timeout — Specifies the maximum amount of time between commands from a remote client. Once triggered, the connection to the remote client is closed.

    El valor predeterminado es 300.

  • listen_address — Specifies the IP address on which vsftpd listens for network connections.

    No hay ningún valor predeterminado para esta directiva.

    Ejecutar varias copias de vsftpd

    If running multiple copies of vsftpd serving different IP addresses, the configuration file for each copy of the vsftpd daemon must have a different value for this directive. See Starting Multiple Copies of vsftpd for more information about multihomed FTP servers.

  • listen_address6 — Specifies the IPv6 address on which vsftpd listens for network connections when listen_ipv6 is set to YES.

    No hay ningún valor predeterminado para esta directiva.

    Ejecutar varias copias de vsftpd

    If running multiple copies of vsftpd serving different IP addresses, the configuration file for each copy of the vsftpd daemon must have a different value for this directive. See Starting Multiple Copies of vsftpd for more information about multihomed FTP servers.

  • listen_port — Specifies the port on which vsftpd listens for network connections.

    El valor predeterminado es 21.

  • local_max_rate — Specifies the maximum rate data is transferred for local users logged into the server in bytes per second.

    El valor predeterminado es 0, el cual no limita la tasa de transferencia.

  • max_clients — Specifies the maximum number of simultaneous clients allowed to connect to the server when it is running in standalone mode. Any additional client connections would result in an error message.

    El valor predeterminado es 0, el cual no limita las conexiones.

  • max_per_ip — Specifies the maximum of clients allowed to connected from the same source IP address.

    El valor predeterminado es 0, el cual no limita las conexiones.

  • pasv_address — Specifies the IP address for the public facing IP address of the server for servers behind Network Address Translation (NAT) firewalls. This enables vsftpd to hand out the correct return address for passive mode connections.

    No hay ningún valor predeterminado para esta directiva.

  • pasv_enable — When enabled, passive mode connects are allowed.

    El valor predeterminado es YES.

  • pasv_max_port — Specifies the highest possible port sent to the FTP clients for passive mode connections. This setting is used to limit the port range so that firewall rules are easier to create.

    El valor predeterminado es 0, el cual no limita el intervalo de puertos pasivos más elevado. El valor no debe exceder 65535.

  • pasv_min_port — Specifies the lowest possible port sent to the FTP clients for passive mode connections. This setting is used to limit the port range so that firewall rules are easier to create.

    El valor predeterminado es 0, el cual no limita el intervalo de puertos pasivos más bajo. El valor no debe ser menor que 1024.

  • pasv_promiscuous — When enabled, data connections are not checked to make sure they are originating from the same IP address. This setting is only useful for certain types of tunneling.

    Evite activar la opción pasv_promiscuous

    Do not enable this option unless absolutely necessary as it disables an important security feature which verifies that passive mode connections originate from the same IP address as the control connection that initiates the data transfer.

    El valor predeterminado es NO.

  • port_enable — When enabled, active mode connects are allowed.

    El valor predeterminado es YES.

Recursos Adicionales

Para obtener más información acerca de vsftpd, consulte los recursos siguientes.

Installed Documentation
  • The /usr/share/doc/vsftpd/ directory — This directory contains a README with basic information about the software. The TUNING file contains basic performance tuning tips and the SECURITY/ directory contains information about the security model employed by vsftpd.

  • vsftpd related man pages — There are a number of man pages for the daemon and configuration files. The following lists some of the more important man pages.

    Aplicaciones para servidores

    • man vsftpd: describe las opciones de línea de órdenes disponibles para vsftpd.

    Archivos de Configuración

    • man vsftpd.conf: contiene una lista detallada de opciones disponibles en el archivo de configuración de vsftpd.

    • man 5 hosts_access — Describes the format and options available within the TCP wrappers configuration files: hosts.allow and hosts.deny.

Useful Websites

Configuración de la impresora

La herramienta de configuración Impresoras sirve para configurar estos aparatos, dar mantenimiento a los archivos de configuración de los dispositivos mismos, los filtros de impresión y los directorios de cola, así como gestionar las clases de impresoras.

La herramienta se basa en el Sistema de Impresión Común de UNIX (CUPS, por sus siglas en inglés). Si ha actualizado el sistema Fedora a partir de una versión anterior que utilizaba CUPS, el proceso de actualización ha conservado las impresoras configuradas.

Uso de la aplicación web y las herramientas de línea de órdenes de CUPS

Puede llevar a cabo las mismas y otras operaciones sobre impresoras directamente desde la aplicación web CUPS o la línea de comandos. Para acceder a la aplicación, en un navegador web, vaya a http://localhost:631/. Para los manuales CUPS vea los enlaces en el tabular Home del sitio web.

Iniciar la herramienta de configuración de impresoras

Con la herramienta de configuración Impresoras puede llevar a cabo diversas operaciones sobre las impresoras existentes y ajustar nuevas impresoras. También puede usar CUPS directamente (vaya a http://localhost:631/ para acceder a la aplicación web CUPS).

Para arrancar la herramienta de configuración Impresoras si está usando el escritorio GNOME, pulse la tecla Super para entrar en la Visión General de Actividades, teclee Impresoras y pulse Enter. Aparece la herramienta de configuración Impresoras. La tecla Super aparece de distintos modos, dependiendo del teclado y otro hardware pero con frecuencia es la tecla Windows o Command y normalmente está a la izquierda de la Barra espaciadora.

Aparece la ventana Impresoras representada en Ventana Configuración de Impresoras.

Ventana de Configuración de impresoras
Figura 2. Ventana de Configuración de impresoras
Iniciando el Ajuste de Impresora

El proceso de ajuste de impresora varia dependiendo del tipo de cola de la impresora.

Si está ajustando una impresora local conectada por USB, la impresora es descubierta y añadida automáticamente. Se le pedirá que confirme los paquetes a instalar y se le pedirá una contraseña de usuario root o administrador. Las impresoras locales conectadas por otros tipos de puerto necesitan ser ajustadas manualmente.

Siga este procedimiento para iniciar un ajuste manual de impresora:

  1. Arranque la herramienta de configuración Impresoras (vea Arrancando la Herramienta de Configuración de Impresoras).

  2. Seleccione Unlock para habilitar que se puedan hacer cambio. En la caja Authentication Required, teclee una contraseña de administrador o la del usuario root y confirme.

  3. Seleccione el signo mas (+) para abrir el diálogo Añadir una Nueva Impresora. Seleccione la impresora de la lista o teclee su dirección debajo.

Añadiendo una Impresora Local

Siga este procedimiento para añadir una impresora local conectado por un puerto distinto al puerto serie:

  1. Abra el diálogo Añadir…​ (vea Empezando el Ajuste de Impresora).

  2. Si el dispositivo no aparece automáticamente, seleccione el puerto al que está conectado la impresora en la lista de la izquierda (como Serial Port #1 o LPT #1).

  3. A la derecha, introduzca las propiedades de la conexión:

    para Enter URI

    URI (por ejemplo archivo:/dev/lp0)

    para Puerto Serie

    Baud Rate

Parity

Data Bits

Flow Control

Adding a local printer
Figura 3. Adding a local printer
  1. Click Forward.

  2. Select the printer model. See Selecting the Printer Model and Finishing for details.

Adding an AppSocket/HP JetDirect printer

Follow this procedure to add an AppSocket/HP JetDirect printer:

  1. Open the Add a New Printer dialog (refer to Starting the Printers Configuration Tool).

  2. In the list on the left, select Network Printer  AppSocket/HP JetDirect.

  3. On the right, enter the connection settings:

    Hostname

    Printer host name or IP address.

    Port Number

    Printer port listening for print jobs (9100 by default).

Adding a JetDirect Printer
Figura 4. Adding a JetDirect printer
  1. Click Forward.

  2. Select the printer model. See Selecting the Printer Model and Finishing for details.

Adding an IPP Printer

An IPP printer is a printer attached to a different system on the same TCP/IP network. The system this printer is attached to may either be running CUPS or simply configured to use IPP.

If a firewall is enabled on the printer server, then the firewall must be configured to allow incoming TCP connections on port 631. Note that the CUPS browsing protocol allows client machines to discover shared CUPS queues automatically. To enable this, the firewall on the client machine must be configured to allow incoming UDP packets on port 631.

Follow this procedure to add an IPP printer:

  1. Open the Printers dialog (refer to Starting Printer Setup).

  2. In the list of devices on the left, select Network Printer and Internet Printing Protocol (ipp) or Internet Printing Protocol (https).

  3. On the right, enter the connection settings:

    Host

    The host name of the IPP printer.

    Queue

    The queue name to be given to the new queue (if the box is left empty, a name based on the device node will be used).

Networked IPP Printer
Figura 5. Adding an IPP printer
  1. Optionally, click Verify to detect the printer.

  2. Click Forward to continue.

  3. Select the printer model. See Selecting the Printer Model and Finishing for details.

Adding an LPD/LPR Host or Printer

Follow this procedure to add an LPD/LPR host or printer:

  1. Open the New Printer dialog (refer to Starting Printer Setup).

  2. In the list of devices on the left, select Network Printer  LPD/LPR Host or Printer.

  3. On the right, enter the connection settings:

    Host

    The host name of the LPD/LPR printer or host.

Optionally, click Probe to find queues on the LPD host.

Queue

The queue name to be given to the new queue (if the box is left empty, a name based on the device node will be used).

Adding an LPD/LPR Printer
Figura 6. Adding an LPD/LPR printer
  1. Click Forward to continue.

  2. Select the printer model. See Selecting the Printer Model and Finishing for details.

Adding a Samba (SMB) printer

Follow this procedure to add a Samba printer:

Installing the samba-client package

Note that in order to add a Samba printer, you need to have the samba-client package installed. You can do so by running, as root:

dnf install samba-client

For more information on installing packages with DNF, refer to Installing Packages.

  1. Open the New Printer dialog (refer to Starting Printer Setup).

  2. In the list on the left, select Network Printer  Windows Printer via SAMBA.

  3. Enter the SMB address in the smb:// field. Use the format computer name/printer share. In Adding a SMB printer, the computer name is dellbox and the printer share is r2.

SMB Printer
Figura 7. Adding a SMB printer
  1. Click Browse to see the available workgroups/domains. To display only queues of a particular host, type in the host name (NetBios name) and click Browse.

  2. Select either of the options:

    1. Prompt user if authentication is required: user name and password are collected from the user when printing a document.

    2. Set authentication details now: provide authentication information now so it is not required later. In the Username field, enter the user name to access the printer. This user must exist on the SMB system, and the user must have permission to access the printer. The default user name is typically guest for Windows servers, or nobody for Samba servers.

  3. Enter the Password (if required) for the user specified in the Username field.

Be careful when choosing a password

Samba printer user names and passwords are stored in the printer server as unencrypted files readable by root and the Linux Printing Daemon, lpd. Thus, other users that have root access to the printer server can view the user name and password you use to access the Samba printer.

Therefore, when you choose a user name and password to access a Samba printer, it is advisable that you choose a password that is different from what you use to access your local Fedora system.

If there are files shared on the Samba print server, it is recommended that they also use a password different from what is used by the print queue.

  1. Click Verify to test the connection. Upon successful verification, a dialog box appears confirming printer share accessibility.

  2. Click Forward.

  3. Select the printer model. See Selecting the Printer Model and Finishing for details.

Selecting the Printer Model and Finishing

Once you have properly selected a printer connection type, the system attempts to acquire a driver. If the process fails, you can locate or search for the driver resources manually.

Follow this procedure to provide the printer driver and finish the installation:

  1. In the window displayed after the automatic driver detection has failed, select one of the following options:

    1. Select printer from database — the system chooses a driver based on the selected make of your printer from the list of Makes. If your printer model is not listed, choose Generic.

    2. Provide PPD file — the system uses the provided PostScript Printer Description (PPD) file for installation. A PPD file may also be delivered with your printer as being normally provided by the manufacturer. If the PPD file is available, you can choose this option and use the browser bar below the option description to select the PPD file.

    3. Search for a printer driver to download — enter the make and model of your printer into the Make and model field to search on OpenPrinting.org for the appropriate packages.

Selecting a printer brand from the printer database brands.
Figura 8. Selecting a printer brand
  1. Depending on your previous choice provide details in the area displayed below:

    • Printer brand for the Select printer from database option.

    • PPD file location for the Provide PPD file option.

    • Printer make and model for the Search for a printer driver to download option.

  2. Click Forward to continue.

  3. If applicable for your option, window shown in Selecting a printer model appears. Choose the corresponding model in the Models column on the left.

Selecting a printer driver

On the right, the recommended printer driver is automatically selected; however, you can select another available driver. The print driver processes the data that you want to print into a format the printer can understand. Since a local printer is attached directly to your computer, you need a printer driver to process the data that is sent to the printer.

Selecting a Printer Model with a Driver Menu
Figura 9. Selecting a printer model
  1. Click Forward.

  2. Under the Describe Printer enter a unique name for the printer in the Printer Name field. The printer name can contain letters, numbers, dashes (-), and underscores (_); it must not contain any spaces. You can also use the Description and Location fields to add further printer information. Both fields are optional, and may contain spaces.

Printer Setup
Figura 10. Printer setup
  1. Click Apply to confirm your printer configuration and add the print queue if the settings are correct. Click Back to modify the printer configuration.

  2. After the changes are applied, a dialog box appears allowing you to print a test page. Click Print Test Page to print a test page now. Alternatively, you can print a test page later as described in Printing a Test Page.

Printing a Test Page

After you have set up a printer or changed a printer configuration, print a test page to make sure the printer is functioning properly:

  1. Right-click the printer in the Printing window and click Properties.

  2. In the Properties window, click Settings on the left.

  3. On the displayed Settings tab, click the Print Test Page button.

Modifying Existing Printers

To delete an existing printer, in the Printer configuration window, select the printer and go to Printer  Delete. Confirm the printer deletion. Alternatively, press the Delete key.

To set the default printer, right-click the printer in the printer list and click the Set As Default button in the context menu.

The Settings Page To change printer driver configuration, double-click the corresponding name in the Printer list and click the Settings label on the left to display the Settings page.

You can modify printer settings such as make and model, print a test page, change the device location (URI), and more.

Settings Page
Figura 11. Settings page
The Policies Page

Click the Policies button on the left to change settings in printer state and print output.

You can select the printer states, configure the Error Policy of the printer (you can decide to abort the print job, retry, or stop it if an error occurs).

You can also create a banner page (a page that describes aspects of the print job such as the originating printer, the user name from the which the job originated, and the security status of the document being printed): click the Starting Banner or Ending Banner drop-down menu and choose the option that best describes the nature of the print jobs (for example, confidential).

Sharing Printers

On the Policies page, you can mark a printer as shared: if a printer is shared, users published on the network can use it. To allow the sharing function for printers, go to Server  Settings and select Publish shared printers connected to this system.

Policies Page
Figura 12. Policies page

Make sure that the firewall allows incoming TCP connections to port 631, the port for the Network Printing Server (IPP) protocol. To allow IPP traffic through the firewall on Fedora 26, make use of firewalld's IPP service. To do so, proceed as follows:

Enabling IPP Service in firewalld
  1. To start the graphical firewall-config tool, press the Super key to enter the Activities Overview, type firewall and then press Enter. The Firewall Configuration window opens. You will be prompted for an administrator or root password.

Alternatively, to start the graphical firewall configuration tool using the command line, enter the following command as root user:

~]# firewall-config

The Firewall Configuration window opens.

Look for the word "Connected" in the lower left corner. This indicates that the firewall-config tool is connected to the user space daemon, firewalld.

To immediately change the current firewall settings, ensure the drop-down selection menu labeled Configuration is set to Runtime. Alternatively, to edit the settings to be applied at the next system start, or firewall reload, select Permanent from the drop-down list.

  1. Select the Zones tab and then select the firewall zone to correspond with the network interface to be used. The default is the public zone. The Interfaces tab shows what interfaces have been assigned to a zone.

  2. Select the Services tab and then select the ipp service to enable sharing. The ipp-client service is required for accessing network printers.

  3. Close the firewall-config tool.

The Access Control Page

You can change user-level access to the configured printer on the Access Control page. Click the Access Control label on the left to display the page. Select either Allow printing for everyone except these users or Deny printing for everyone except these users and define the user set below: enter the user name in the text box and click the Add button to add the user to the user set.

Access Control Page
Figura 13. Access Control page
The Printer Options Page

The Printer Options page contains various configuration options for the printer media and output, and its content may vary from printer to printer. It contains general printing, paper, quality, and printing size settings.

Printer Options Page
Figura 14. Printer Options page
Job Options Page

On the Job Options page, you can detail the printer job options. Click the Job Options label on the left to display the page. Edit the default settings to apply custom job options, such as number of copies, orientation, pages per side, scaling (increase or decrease the size of the printable area, which can be used to fit an oversize print area onto a smaller physical sheet of print medium), detailed text options, and custom job options.

Job Options Page
Figura 15. Job Options page
Ink/Toner Levels Page

The Ink/Toner Levels page contains details on toner status if available and printer status messages. Click the Ink/Toner Levels label on the left to display the page.

Ink/Toner Levels Page
Figura 16. Ink/Toner Levels page
Managing Print Jobs When you send a print job to the printer daemon, such as printing a text file from Emacs or printing an image from GIMP, the print job is added to the print spool queue. The print spool queue is a list of print jobs that have been sent to the printer and information about each print request, such as the status of the request, the job number, and more.

During the printing process, messages informing about the process appear in the notification area.

GNOME Print Status
Figura 17. GNOME Print Status

To cancel, hold, release, reprint or authenticate a print job, select the job in the GNOME Print Status and on the Job menu, click the respective command.

To view the list of print jobs in the print spool from a shell prompt, type the command lpstat -o. The last few lines look similar to the following:

Ejemplo 10. Example of lpstat -o output
$ lpstat -o
Charlie-60              twaugh            1024   Tue 08 Feb 2011 16:42:11 GMT
Aaron-61                twaugh            1024   Tue 08 Feb 2011 16:42:44 GMT
Ben-62                  root              1024   Tue 08 Feb 2011 16:45:42 GMT

If you want to cancel a print job, find the job number of the request with the command lpstat -o and then use the command cancel job number. For example, cancel 60 would cancel the print job in Example of lpstat -o output. You cannot cancel print jobs that were started by other users with the cancel command. However, you can enforce deletion of such job by issuing the cancel -U root job_number command. To prevent such canceling, change the printer operation policy to Authenticated to force root authentication.

You can also print a file directly from a shell prompt. For example, the command lp sample.txt prints the text file sample.txt. The print filter determines what type of file it is and converts it into a format the printer can understand.

Recursos Adicionales

To learn more about printing on Fedora, see the following resources.

Installed Documentation
man lp

The manual page for the lpr command that allows you to print files from the command line.

man cancel

The manual page for the command-line utility to remove print jobs from the print queue.

man mpage

The manual page for the command-line utility to print multiple pages on one sheet of paper.

man cupsd

The manual page for the CUPS printer daemon.

man cupsd.conf

The manual page for the CUPS printer daemon configuration file.

man classes.conf

The manual page for the class configuration file for CUPS.

man lpstat

The manual page for the lpstat command, which displays status information about classes, jobs, and printers.

Useful Websites
https://wiki.linuxfoundation.org/openprinting/start

Open Printing contains a large amount of information about printing in Linux.

http://www.cups.org/

Documentation, FAQs, and newsgroups about CUPS.