Rsync auto login and schedule sync

Discussion in 'HOWTO-Related Questions' started by dalitso, Nov 11, 2010.

  1. dalitso

    dalitso New Member

    I have setup Rsync as a daemon on a Ubuntu 10.04 box and the setup was successful. Here are my configs

    root@hurricane:`# nano /etc/default/rsync
    # defaults file for rsync daemon mode
    # start rsync in daemon mode from init.d script?
    #  only allowed values are "true", "false", and "inetd"
    #  Use "inetd" if you want to start the rsyncd from inetd,
    #  all this does is prevent the init.d script from printing a message
    #  about not starting rsyncd (you still need to modify inetd's config yourself).
    # which file should be used as the configuration file for rsync.
    # This file is used instead of the default /etc/rsyncd.conf
    # Warning: This option has no effect if the daemon is accessed
    #          using a remote shell. When using a different file for
    #          rsync you might want to symlink /etc/rsyncd.conf to
    #          that file.
    # what extra options to give rsync --daemon?
    #  that excludes the --daemon; that's always done in the init.d script
    #  Possibilities are:
    #   --address=		(bind to a specific IP address)
    #   --port=8730				(bind to specified port; default 873)
    # run rsyncd at a nice level?
    #  the rsync daemon can impact performance due to much I/O and CPU usage,
    #  so you may want to run it at a nicer priority than the default priority.
    #  Allowed values are 0 - 19 inclusive; 10 is a reasonable value.
    # run rsyncd with ionice?
    #  "ionice" does for IO load what "nice" does for CPU load.
    #  As rsync is often used for backups which aren't all that time-critical,
    #  reducing the rsync IO priority will benefit the rest of the system.
    #  See the manpage for ionice for allowed options.
    #  -c3 is recommended, this will run rsync IO at "idle" priority. Uncomment
    #  the next line to activate this.
    # RSYNC_IONICE='-c3'
    # Don't forget to create an appropriate config file,
    # else the daemon will not start.
    root@hurricane:`# nano /etc/xinetd.d/rsync
    service rsync
        disable = no
        socket_type = stream
        wait = no
        user = root
        server = /usr/bin/rsync
        server_args = --daemon
        log_on_failure += USERID
    root@hurricane:`# nano /etc/rsyncd.conf 
    max connections = 2
    log file = /var/log/rsync.log
    timeout = 300
    comment = Public Share
    path = /home/all2
    read only = no
    list = yes
    uid = nobody
    gid = nogroup
    auth users = share
    secrets file = /etc/rsyncd.secrets
    root@hurricane:`# nano /etc/rsyncd.secrets
    root@hurricane:`# nano /etc/services
    # Network services, Internet style
    # Note that it is presently the policy of IANA to assign a single well-known
    # port number for both TCP and UDP; hence, officially ports have two entries
    # even if the protocol doesn't support UDP operations.
    # Updated from and other
    # sources like .
    # New ports will be added on request if they have been officially assigned
    # by IANA and used in the real-world or are needed by a debian package.
    # If you need a huge list of used numbers please install the nmap package.
    tcpmux		1/tcp				# TCP port service multiplexer
    echo		7/tcp
    echo		7/udp
    discard		9/tcp		sink null
    discard		9/udp		sink null
    systat		11/tcp		users
    daytime		13/tcp
    daytime		13/udp
    netstat		15/tcp
    qotd		17/tcp		quote
    msp		18/tcp				# message send protocol
    msp		18/udp
    chargen		19/tcp		ttytst source
    chargen		19/udp		ttytst source
    ftp-data	20/tcp
    ftp		21/tcp
    fsp		21/udp		fspd
    ssh		22/tcp				# SSH Remote Login Protocol
    ssh		22/udp
    telnet		23/tcp
    smtp		25/tcp		mail
    time		37/tcp		timserver
    time		37/udp		timserver
    rlp		39/udp		resource	# resource location
    nameserver	42/tcp		name		# IEN 116
    whois		43/tcp		nicname
    tacacs		49/tcp				# Login Host Protocol (TACACS)
    tacacs		49/udp
    re-mail-ck	50/tcp				# Remote Mail Checking Protocol
    re-mail-ck	50/udp
    domain		53/tcp				# name-domain server
    domain		53/udp
    mtp		57/tcp				# deprecated
    tacacs-ds	65/tcp				# TACACS-Database Service
    tacacs-ds	65/udp
    bootps		67/tcp				# BOOTP server
    bootps		67/udp
    bootpc		68/tcp				# BOOTP client
    bootpc		68/udp
    tftp		69/udp
    gopher		70/tcp				# Internet Gopher
    gopher		70/udp
    rje		77/tcp		netrjs
    finger		79/tcp
    www		80/tcp		http		# WorldWideWeb HTTP
    www		80/udp				# HyperText Transfer Protocol
    link		87/tcp		ttylink
    kerberos	88/tcp		kerberos5 krb5 kerberos-sec	# Kerberos v5
    kerberos	88/udp		kerberos5 krb5 kerberos-sec	# Kerberos v5
    supdup		95/tcp
    hostnames	101/tcp		hostname	# usually from sri-nic
    iso-tsap	102/tcp		tsap		# part of ISODE
    acr-nema	104/tcp		dicom		# Digital Imag. & Comm. 300
    acr-nema	104/udp		dicom		# Digital Imag. & Comm. 300
    csnet-ns	105/tcp		cso-ns		# also used by CSO name server
    csnet-ns	105/udp		cso-ns
    rtelnet		107/tcp				# Remote Telnet
    rtelnet		107/udp
    pop2		109/tcp		postoffice pop-2 # POP version 2
    pop2		109/udp		pop-2
    pop3		110/tcp		pop-3		# POP version 3
    pop3		110/udp		pop-3
    sunrpc		111/tcp		portmapper	# RPC 4.0 portmapper
    sunrpc		111/udp		portmapper
    auth		113/tcp		authentication tap ident
    sftp		115/tcp
    uucp-path	117/tcp
    nntp		119/tcp		readnews untp	# USENET News Transfer Protocol
    ntp		123/tcp
    ntp		123/udp				# Network Time Protocol
    pwdgen		129/tcp				# PWDGEN service
    pwdgen		129/udp				# PWDGEN service
    loc-srv		135/tcp		epmap		# Location Service
    loc-srv		135/udp		epmap
    netbios-ns	137/tcp				# NETBIOS Name Service
    netbios-ns	137/udp
    netbios-dgm	138/tcp				# NETBIOS Datagram Service
    netbios-dgm	138/udp
    netbios-ssn	139/tcp				# NETBIOS session service
    netbios-ssn	139/udp
    imap2		143/tcp		imap		# Interim Mail Access P 2 and 4
    imap2		143/udp		imap
    snmp		161/tcp				# Simple Net Mgmt Protocol
    snmp		161/udp				# Simple Net Mgmt Protocol
    snmp-trap	162/tcp		snmptrap	# Traps for SNMP
    snmp-trap	162/udp		snmptrap	# Traps for SNMP
    cmip-man	163/tcp				# ISO mgmt over IP (CMOT)
    cmip-man	163/udp
    cmip-agent	164/tcp
    cmip-agent	164/udp
    mailq		174/tcp			# Mailer transport queue for Zmailer
    mailq		174/udp			# Mailer transport queue for Zmailer
    xdmcp		177/tcp				# X Display Mgr. Control Proto
    xdmcp		177/udp
    nextstep	178/tcp		NeXTStep NextStep	# NeXTStep window
    nextstep	178/udp		NeXTStep NextStep	#  server
    bgp		179/tcp				# Border Gateway Protocol
    bgp		179/udp
    prospero	191/tcp				# Cliff Neuman's Prospero
    prospero	191/udp
    irc		194/tcp				# Internet Relay Chat
    irc		194/udp
    smux		199/tcp				# SNMP Unix Multiplexer
    smux		199/udp
    at-rtmp		201/tcp				# AppleTalk routing
    at-rtmp		201/udp
    at-nbp		202/tcp				# AppleTalk name binding
    at-nbp		202/udp
    at-echo		204/tcp				# AppleTalk echo
    at-echo		204/udp
    at-zis		206/tcp				# AppleTalk zone information
    at-zis		206/udp
    qmtp		209/tcp				# Quick Mail Transfer Protocol
    qmtp		209/udp				# Quick Mail Transfer Protocol
    z3950		210/tcp		wais		# NISO Z39.50 database
    z3950		210/udp		wais
    ipx		213/tcp				# IPX
    ipx		213/udp
    imap3		220/tcp				# Interactive Mail Access
    imap3		220/udp				# Protocol v3
    pawserv		345/tcp				# Perf Analysis Workbench
    pawserv		345/udp
    zserv		346/tcp				# Zebra server
    zserv		346/udp
    fatserv		347/tcp				# Fatmen Server
    fatserv		347/udp
    rpc2portmap	369/tcp
    rpc2portmap	369/udp				# Coda portmapper
    codaauth2	370/tcp
    codaauth2	370/udp				# Coda authentication server
    clearcase	371/tcp		Clearcase
    clearcase	371/udp		Clearcase
    ulistserv	372/tcp				# UNIX Listserv
    ulistserv	372/udp
    ldap		389/tcp			# Lightweight Directory Access Protocol
    ldap		389/udp
    imsp		406/tcp			# Interactive Mail Support Protocol
    imsp		406/udp
    https		443/tcp				# http protocol over TLS/SSL
    https		443/udp
    snpp		444/tcp				# Simple Network Paging Protocol
    snpp		444/udp
    microsoft-ds	445/tcp				# Microsoft Naked CIFS
    microsoft-ds	445/udp
    kpasswd		464/tcp
    kpasswd		464/udp
    saft		487/tcp			# Simple Asynchronous File Transfer
    saft		487/udp
    isakmp		500/tcp			# IPsec - Internet Security Association
    isakmp		500/udp			#  and Key Management Protocol
    rtsp		554/tcp			# Real Time Stream Control Protocol
    rtsp		554/udp			# Real Time Stream Control Protocol
    nqs		607/tcp				# Network Queuing system
    nqs		607/udp
    npmp-local	610/tcp		dqs313_qmaster		# npmp-local / DQS
    npmp-local	610/udp		dqs313_qmaster
    npmp-gui	611/tcp		dqs313_execd		# npmp-gui / DQS
    npmp-gui	611/udp		dqs313_execd
    hmmp-ind	612/tcp		dqs313_intercell	# HMMP Indication / DQS
    hmmp-ind	612/udp		dqs313_intercell
    qmqp		628/tcp
    qmqp		628/udp
    ipp		631/tcp				# Internet Printing Protocol
    ipp		631/udp
    # UNIX specific services
    exec		512/tcp
    biff		512/udp		comsat
    login		513/tcp
    who		513/udp		whod
    shell		514/tcp		cmd		# no passwords used
    syslog		514/udp
    printer		515/tcp		spooler		# line printer spooler
    talk		517/udp
    ntalk		518/udp
    route		520/udp		router routed	# RIP
    timed		525/udp		timeserver
    tempo		526/tcp		newdate
    courier		530/tcp		rpc
    conference	531/tcp		chat
    netnews		532/tcp		readnews
    netwall		533/udp				# for emergency broadcasts
    gdomap		538/tcp				# GNUstep distributed objects
    gdomap		538/udp
    uucp		540/tcp		uucpd		# uucp daemon
    klogin		543/tcp				# Kerberized `rlogin' (v5)
    kshell		544/tcp		krcmd		# Kerberized `rsh' (v5)
    afpovertcp	548/tcp				# AFP over TCP
    afpovertcp	548/udp
    remotefs	556/tcp		rfs_server rfs	# Brunhoff remote filesystem
    nntps		563/tcp		snntp		# NNTP over SSL
    nntps		563/udp		snntp
    submission	587/tcp				# Submission [RFC4409]
    submission	587/udp
    ldaps		636/tcp				# LDAP over SSL
    ldaps		636/udp
    tinc		655/tcp				# tinc control port
    tinc		655/udp
    silc		706/tcp
    silc		706/udp
    kerberos-adm	749/tcp				# Kerberos `kadmin' (v5)
    webster		765/tcp				# Network dictionary
    webster		765/udp
    rsync		873/tcp
    rsync		873/udp
    ftps-data	989/tcp				# FTP over SSL (data)
    ftps		990/tcp
    telnets		992/tcp				# Telnet over SSL
    telnets		992/udp
    imaps		993/tcp				# IMAP over SSL
    imaps		993/udp
    ircs		994/tcp				# IRC over SSL
    ircs		994/udp
    pop3s		995/tcp				# POP-3 over SSL
    pop3s		995/udp
    # From ``Assigned Numbers'':
    #> The Registered Ports are not controlled by the IANA and on most systems
    #> can be used by ordinary user processes or programs executed by ordinary
    #> users.
    #> Ports are used in the TCP [45,106] to name the ends of logical
    #> connections which carry long term conversations.  For the purpose of
    #> providing services to unknown callers, a service contact port is
    #> defined.  This list specifies the port used by the server process as its
    #> contact port.  While the IANA can not control uses of these ports it
    #> does register or list uses of these ports as a convienence to the
    #> community.
    socks		1080/tcp			# socks proxy server
    socks		1080/udp
    proofd		1093/tcp
    proofd		1093/udp
    rootd		1094/tcp
    rootd		1094/udp
    openvpn		1194/tcp
    openvpn		1194/udp
    rmiregistry	1099/tcp			# Java RMI Registry
    rmiregistry	1099/udp
    kazaa		1214/tcp
    kazaa		1214/udp
    nessus		1241/tcp			# Nessus vulnerability
    nessus		1241/udp			#  assessment scanner
    lotusnote	1352/tcp	lotusnotes	# Lotus Note
    lotusnote	1352/udp	lotusnotes
    ms-sql-s	1433/tcp			# Microsoft SQL Server
    ms-sql-s	1433/udp
    ms-sql-m	1434/tcp			# Microsoft SQL Monitor
    ms-sql-m	1434/udp
    ingreslock	1524/tcp
    ingreslock	1524/udp
    prospero-np	1525/tcp			# Prospero non-privileged
    prospero-np	1525/udp
    datametrics	1645/tcp	old-radius
    datametrics	1645/udp	old-radius
    sa-msg-port	1646/tcp	old-radacct
    sa-msg-port	1646/udp	old-radacct
    kermit		1649/tcp
    kermit		1649/udp
    l2f		1701/tcp	l2tp
    l2f		1701/udp	l2tp
    radius		1812/tcp
    radius		1812/udp
    radius-acct	1813/tcp	radacct		# Radius Accounting
    radius-acct	1813/udp	radacct
    msnp		1863/tcp			# MSN Messenger
    msnp		1863/udp
    unix-status	1957/tcp			# remstats unix-status server
    log-server	1958/tcp			# remstats log server
    remoteping	1959/tcp			# remstats remoteping server
    cisco-sccp	2000/tcp	sieve		# Cisco SCCP
    cisco-sccp	2000/udp
    search		2010/tcp	ndtp
    pipe_server	2010/tcp
    nfs		2049/tcp			# Network File System
    nfs		2049/udp			# Network File System
    gnunet		2086/tcp
    gnunet		2086/udp
    rtcm-sc104	2101/tcp			# RTCM SC-104 IANA 1/29/99
    rtcm-sc104	2101/udp
    gsigatekeeper	2119/tcp
    gsigatekeeper	2119/udp
    gris		2135/tcp		# Grid Resource Information Server
    gris		2135/udp		# Grid Resource Information Server
    cvspserver	2401/tcp			# CVS client/server operations
    cvspserver	2401/udp
    venus		2430/tcp			# codacon port
    venus		2430/udp			# Venus callback/wbc interface
    venus-se	2431/tcp			# tcp side effects
    venus-se	2431/udp			# udp sftp side effect
    codasrv		2432/tcp			# not used
    codasrv		2432/udp			# server port
    codasrv-se	2433/tcp			# tcp side effects
    codasrv-se	2433/udp			# udp sftp side effect
    mon		2583/tcp			# MON traps
    mon		2583/udp
    dict		2628/tcp			# Dictionary server
    dict		2628/udp
    gsiftp		2811/tcp
    gsiftp		2811/udp
    gpsd		2947/tcp
    gpsd		2947/udp
    gds_db		3050/tcp			# InterBase server
    gds_db		3050/udp
    icpv2		3130/tcp	icp		# Internet Cache Protocol
    icpv2		3130/udp	icp
    mysql		3306/tcp
    mysql		3306/udp
    nut		3493/tcp			# Network UPS Tools
    nut		3493/udp
    distcc		3632/tcp			# distributed compiler
    distcc		3632/udp
    daap		3689/tcp			# Digital Audio Access Protocol
    daap		3689/udp
    svn		3690/tcp	subversion	# Subversion protocol
    svn		3690/udp	subversion
    suucp		4031/tcp			# UUCP over SSL
  2. falko

    falko Super Moderator

    What is your question?
  3. dalitso

    dalitso New Member

    I am sorry, the post was incomplete, heres the rest

    root@hurricane:`#nano /etc/inetd.conf
    #<off># netbios-ssn	stream	tcp	nowait	root	/usr/sbin/tcpd	/usr/sbin/smbd
    #<off># ftp	stream	tcp	nowait	root	/usr/sbin/tcpd /usr/sbin/proftpd
    #<off># sane-port	stream	tcp	nowait	saned:saned	/usr/sbin/saned saned
    rsync stream tcp nowait root /usr/bin/rsync rsyncd --daemon
    I have another Ubuntu box with the same setup (with the login user details being different) So I am doing a remote sync this command

    root@hurricane:~# rsync -azvv jhbs@ /home/all2/

    Running the above command asks for a password which when entered the sync is done.

    How do I automate the file sync?

    1. Have it to auto login; without asking for the password
    2. schedule sync like hourly

    Heres some progress, I am now learning OpenSSH Keys so that I can setup auto login. Will let you know the progress.
  4. falko

    falko Super Moderator

  5. dalitso

    dalitso New Member

    My ubuntu 10.04 box cannot resolve to its host name but it works with the IP address and hurricane.local
    root@dalitso:/home/martin# rsync -avz -e ssh /home/martin/all2/
    ssh: Could not resolve hostname Name or service not known
    root@dalitso:/home/martin# rsync -avz -e ssh jhbs@hurricane:/home/all2 /home/martin/all2/
    The authenticity of host 'hurricane (' can't be established.
    RSA key fingerprint is 41:71:8d:bb:55:2e:20:97:ac:9b:dd:c7:cb:9b:66:b5.
    Are you sure you want to continue connecting (yes/no)?
    Heres my setup: ADSL router with ip ---> Dlink Switch ---> ubuntu server with ip

    I am also accessing the server using an ubuntu desktop connected to the same switch

    And here are some configuration files

    root@hurricane:~# nano /etc.hosts	localhost.localdomain localhost hurricane
    # The following lines are desirable for IPv6 capable hosts
    ::1     ip6-localhost ip6-loopback
    fe00::0 ip6-localnet
    ff00::0 ip6-mcastprefix
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters
    ff02::3 ip6-allhosts
    root@hurricane:~# nano /etc/resolv.conf
    # /etc/nsswitch.conf
    # Example configuration of GNU Name Service Switch functionality.
    # If you have the `glibc-doc-reference' and `info' packages installed, try:
    # `info libc "Name Service Switch"' for information about this file.
    passwd:         compat
    group:          compat
    shadow:         compat
    #hosts:	files mdns4_minimal [NOTFOUND=return] dns mdns4
    hosts:	files wins dns 
    networks:       files
    protocols:      db files
    services:       db files
    ethers:         db files
    rpc:            db files
    netgroup:       nis
    root@hurricane:/home/jhbs# hostname
    The server was setup with webmin so Bind DNS server has got only Root, localhost, 0, 127, 255 zones.

    Help me get the hostname resolved, the tutorial said something like, it will only work when a FQDN is used.
    Let me know if you need me to post more information.
  6. dalitso

    dalitso New Member

Share This Page