31 Mar 2010

rsync modules

Dùng cái này
#!/usr/bin/python
import os
root = '/home/'
names = os.listdir(root)
#names = open('/mnt/data/names.txt','r')
names.sort()
for line in names:
#    if not line:
#        break
    if not os.path.isdir(root + line):
        continue
    if line == 'lost+found':
        continue
    print "[" "%s" "]" %line
    print '        comment = ''%s' %line
    print '        path ='+root +line
    print """        use chroot = yes  
        max connections=10  
        lock file = /var/lock/rsyncd  
        read only = no  
        list = yes 
              """
    print '        uid= '+line
    print '        gid= '+line
    print """        ignore errors = no  
        ignore nonreadable = yes  
        transfer logging = no  
        log format = %t: host %h (%a) %o %f (%l bytes). Total %b bytes.  
        timeout = 600  
        refuse options = checksum dry-run  
        dont compress = *.gz *.tgz *.zip *.z *.rpm *.deb *.iso *.bz2 *.tbz  
              """

với cái này sẽ tiết kiệm được chút thời gian và công sức :).

29 Mar 2010

Bị tấn công

Kiểm tra /var/log/messages thì phát hiện ra cái này http://pastebin.com/Wz8LE7tW
Cái hơi hay ho ở đây là log trên của laptop. Không biết bạn nào rảnh đi brute force ssh laptop của mình ;))

6 Mar 2010

Stupid

Just updated my gentoo box and some features get problem. All should be solved by running "revdep-rebuild" to re-install some missing library. But there's an interesting bug (?) of wicd after update :). You cannot start wicd daemon with error
g3n2 ~ # /etc/init.d/wicd restart
/etc/init.d/wicd: line 12: syntax error: unexpected end of file
 * ERROR:  /etc/init.d/wicd has syntax errors in it; aborting ...
Take a look at wicd init script, someone who made update for wicd did make a mistake:
#!/sbin/runscript
 2 # Copyright 1999-2006 Gentoo Foundation
 3 # Distributed under the terms of the GNU General Public License v2
 4 
 5 opts="start stop restart"
 6 
 7 WICD_DAEMON=/usr/sbin/wicd
 8 WICD_PIDFILE=/var/run/wicd/wicd.pid
 9 
10 depend() {

11                   need dbus
Function depend() has no close parenthesis, and where is start() and stop() function? I don't know.I solved it by adding some line like bellow:
1 #!/sbin/runscript
 2 # Copyright 1999-2006 Gentoo Foundation
 3 # Distributed under the terms of the GNU General Public License v2
 4 
 5 opts="start stop restart"
 6 
 7 WICD_DAEMON=/usr/sbin/wicd
 8 WICD_PIDFILE=/var/run/wicd/wicd.pid
 9 
10 depend() {
11     need dbus
12     }
13 start() {
14             ebegin "Starting wicd daemon"
15                     "${WICD_DAEMON}" >/dev/null 2>&1
16                             eend $?
17 }
18 
19 stop() {
20             ebegin "Stopping wicd daemon"
21                     start-stop-daemon --stop --pidfile "${WICD_PIDFILE}"
22                             eend $?
23 }
Who works for the maintenance of wicd on gentoo? wtf

4 Mar 2010

portage-2.1.8 has new --rebuilt-binaries option

In portage-2.1.8 there's a new emerge --rebuilt-binaries
option that is very useful for people who build binary packages and
install them on multiple computers (using PORTAGE_BINHOST or shared
PKGDIR). The option causes packages to be automatically reinstalled in
cases when rebuilt binary packages are available (due to revdep-rebuild
or similar cases).
Rebuilds are detected by comparison of BUILD_TIME package metadata.
This option is enabled automatically when using binary packages
(--usepkgonly or --getbinpkgonly) together with --update and --deep.


http://blogs.gentoo.org/zmedico/2010/03/03/rebuilt_binaries_portage_2_1-8

Disqus