.

cyrillic in gopherspace

gopher://gopher.rp.spb.su:70/0/books/zubov.utf

Posted on 30 Jun 2013, 23:39
Category: gopher


Edit - Delete


get e-mail on ssh login

1. Create a script sending an e-mail. I would suggest one sending the output of this command:

$ w

Despite its brevity, it is quite useful: it lists all the users currently logged-in and their ip's.

2. (If it does not exist,) create the file /etc/ssh/sshrc . The commands in this file are executed when a user logs in. Add a line launching your e-mail script.

Posted on 22 Mar 2013, 2:02
Category: linux


Edit - Delete


change file encoding

Convert file a.txt from Windows-1251 to UTF-8 and write output to b.txt:

$ iconv -f WINDOWS-1251 -t UTF-8 -o b.txt a.txt

Posted on 21 Mar 2013, 3:06
Category: linux


Edit - Delete


open ports and servers

active servers and what ports they are listening on:

$ netstat -lnptu

Posted on 24 Feb 2013, 2:14
Category: linux


Edit - Delete


hostname

get the hostname of the machine:

$ hostname

get the FQDN (Fully Qualified Domain Name) of the machine (if there is one!):

$ hostname --fqdn

Posted on 23 Feb 2013, 16:24
Category: linux


Edit - Delete


list directories

list just directories

$ ls -d */

list the directories which start with letter b

$ ls -d b*/

list the subdirectories of the directories which start with letter b

$ ls -d b*/*/

list hidden directories

$ ls -d .*/

list with details, and with nice colors:

$ ls -d .*/ -l

Posted on 23 Feb 2013, 14:54
Category: linux


Edit - Delete


create tarball

create tarball of a directory and all of its content:

$ tar -zcvf directory.tar.gz /path/to/directory

Explanation of options -zcvf
z = compress the archive through gzip
c = create a new archive
v = verbose which means list the progress while creating the archive
f = use archive file

extract files from the tarball:

$ tar -zxvf directory.tar.gz

Explanation of options -zxvf
z = compress the archive through gzip
x = extract files from an archive
v = verbose which means list the progress while creating the archive
f = use archive file

Posted on 22 Feb 2013, 4:03
Category: linux


Edit - Delete


logged-in users

The w, who, users and finger commands help finding out the users who are currently logged in on the machine.

Posted on 19 Feb 2013, 3:21
Category: linux


Edit - Delete


GET

to be able to use

$ GET http://a.site.com/stuff.html

one has to do

$ sudo apt-get install libwww-perl

Posted on 18 Feb 2013, 12:34
Category: linux


Edit - Delete


missing libraries

to get a list of all libraries a program needs and where it is looking for them, just type

$ ldd PROGRAM_FILENAME

Posted on 15 Feb 2013, 22:59
Category: linux


Edit - Delete


prosody xmpp server

there are TWO places in prosody.cfg.lua file where you need to provide a path to ssl certificate and key if you want to use encryption. TWO. TWO. This:

-- These are the SSL/TLS-related settings. If you don't want
-- to use SSL/TLS, you may comment or remove this

ssl = {
	key = "/etc/prosody/certs/prosody.key";
	certificate = "/etc/prosody/certs/prosody.cert";
}


AND this:

VirtualHost "infimus.org"

	-- Assign this host a certificate for TLS, otherwise it would use the one
	-- set in the global section (if any).
	-- Note that old-style SSL on port 5223 only supports one certificate, and will always
	-- use the global one.
	ssl = {
		key = "/etc/prosody/certs/prosody.key";
		certificate = "/etc/prosody/certs/prosody.crt";
	}


The second can probably be commented out (seems to be a per-host setting), but I am tired of silly experimenting.

Posted on 10 Feb 2013, 13:49
Category: linux


Edit - Delete


vsftpd (install and configure)

install:

$ apt-get install vsftpd

configure:

1. stop the vsftpd by typing:

$ service vsftpd stop

2. edit /etc/vsftpd.conf

$ vim /etc/vsftpd.conf

make the following changes:

2.1 no anonymous login:

anonymous_enable=NO

2.2 enable local users:

local_enable=YES

2.3 we should be able to write data:

write_enable=YES

2.4 set umask to 022 to make sure that all the files (644) and folders (755) you upload get the proper permissions:

local_umask=022

2.5 save and quit vim :-)

3. create user

$ useradd -d /var/www/path/to/your/dir -s /usr/sbin/nologin ftpuser

4. create a password for the user:

$ passwd ftpuser

In order to enable the ftpuser read and write the data in your home dir, change the permission and take ownership:

$ chown -R ftpuser /var/www/path/to/your/dir
$ chmod 775 /var/www/path/to/your/dir


5. create userlist file and add the user:

$ vim /etc/vsftpd.userlist

and add the user:

ftpuser

6. save the file and open the vsftp.conf file again:

$ vim /etc/vsftpd.conf

Add the following lines at the end of the file and save it:

# the list of users to give access
userlist_file=/etc/vsftpd.userlist


# this list is on
userlist_enable=YES


# It is not a list of users to deny ftp access
userlist_deny=NO


7. add a nologin to the shell set:

$ vim /etc/shells

The file should look like this:

/bin/ksh
/usr/bin/rc
/usr/bin/tcsh
/bin/tcsh
/usr/bin/esh
/bin/dash
/bin/bash
/bin/rbash


Add this line at the end:

/usr/sbin/nologin

8. create a usergroup and add the ftpuser to it:

$ addgroup ftpusers
$ usermod -Gftpusers ftpuser

9. check whether your ftp login is not in the file of users who are prohibited ftp access:

$ vim /etc/ftpusers

10. start the vsftpd:

$ service vsftpd start



Posted on 10 Feb 2013, 13:40
Category: linux


Edit - Delete


get ip's of a domain

$ nslookup infimus.org

Posted on 9 Feb 2013, 3:07
Category: linux


Edit - Delete


ssl with apache2 (quick and dirty)

$ a2enmod ssl

$ a2ensite default-ssl

$ make-ssl-cert generate-default-snakeoil --force-overwrite


Restart apache2. Since the certificate is self-signed, every newcomer will have to add a security exception in his browser.

Edit /etc/apache2/sites-enabled/default-ssl to add php and perl cgi support.

Posted on 4 Feb 2013, 19:27
Category: linux


Edit - Delete


bbb

http://code.google.com/p/bigbluebutton/wiki/FAQ

Posted on 2 Feb 2013, 18:11
Category: bbb


Edit - Delete


elgg links (social network engine)

http://elgg.reglot.org/

http://elgg.org

Posted on 1 Feb 2013, 17:59
Category: current work


Edit - Delete


grep

$ grep -r 'ramesh' *

will look for the string “ramesh” in all the files in the current directory and all it’s subdirectories.

Posted on 30 Jan 2013, 13:35
Category: linux


Edit - Delete


find a file by its name

$ find . -name foo\*bar

This will search from the current directory down for foo*bar (that is, any filename that begins with foo and ends with bar).

Posted on 30 Jan 2013, 13:07
Category: linux


Edit - Delete


identify filesystems

$ df -Th

Posted on 30 Jan 2013, 13:08
Category: linux


Edit - Delete


cron and time zone

After changing time zone

$ dpkg-reconfigure tzdata

restart cron

$ /etc/rc.d/cron restart

to let it know the time zone has been changed, or else the cron jobs will use the previous time zone (on your system the command which restarts cron may look different).

Posted on 29 Jan 2013, 21:35
Category: linux


Edit - Delete


download whole site

download recursively whole site:

$ wget -r -l 0 http://all-index.ru

Posted on 25 Jan 2013, 14:47
Category: linux


Edit - Delete


grep

$ grep -r 'ramesh' *

will look for the string 'ramesh' in all the files in the current directory and all it’s subdirectories.

Posted on 30 Jan 2013, 13:32
Category: linux


Edit - Delete


compress everything into .tar.gz

Compress a dir (including contents) or file: $ tar -cvzf archive_file_name.tar.gz dir_or_file_name Compress everything in ./ and below: $ tar -cvzf archive_file_name.tar.gz *

Posted on 7 Aug 2014, 22:57
Category: linux


Edit - Delete


Pages: [1]