sudo systemctrl network-manager restart
nmcli
sudo ifup -a
sudo netplan generate
sudo systemctrl network-manager restart
nmcli
sudo ifup -a
sudo netplan generate
sudo /etc/init.d/networking restartIt gives me this message
* Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces
* Reconfiguring network interfaces...
/bin/sh: cannot open /etc/iptables_rules: No such file
Failed to bring up eth0.
sudo killall NetworkMangerNow we can configure our ethernet/wify interface.
Some services are having different starting points in linux. for example webmin: To start webmin we need to execute the command /etc/webmin/start where as all service can be started as /etc/init.d/service-name start. this is comman practice now. so we will write a shell script which will allow us to make it auto-start and shutdown for a service with comman practice & will start when we boot up the computer. lets take an example of webmin.
To make webmin automatically start when we boot up the computer,Create a file in "/etc/init.d/" directory as
sudo vi /etc/init.d/webmin
# Webmin auto-start
#
# description: Auto-starts webmin
# processname: webmin
# pidfile: /var/run/webmin.pid
case $1 in
start)
sh /etc/webmin start
;;
stop)
sh /etc/webmin stop
;;
restart)
sh /etc/webmin start
sh /etc/webmin stop
;;
esac
exit 0
now we need to change the file permission of this file so that it become executable.
sudo chmod 755 /etc/init.d/webmin
The now the final step is to linking this script to the startup folders with a symbolic link as.
sudo ln -s /etc/init.d/webmin /etc/rc1.d/K99webmin
sudo ln -s /etc/init.d/webmin /etc/rc2.d/S99webmin
Now we are ready with our new set of commands to start, stop & restart the service as
sudo /etc/init.d/webmin start
sudo /etc/init.d/webmin stop
sudo /etc/init.d/webmin restart
ssh -i keypairfilename.pem ubuntu@public_address of AMI
find/path/to/files* -mtime +5 -execrm{} \;
CD /directory/path
Find . -mmin +120 -delete
Find . -mtime +2 -delete
$ sudo apt-get install vsftpdPassword:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
vsftpd
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 121kB of archives.
After unpacking 438kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com edgy/main vsftpd 2.0.4-0ubuntu5 [121kB]
Fetched 121kB in 0s (246kB/s)
Selecting previously deselected package vsftpd.
(Reading database ... 31396 files and directories currently installed.)
Unpacking vsftpd (from .../vsftpd_2.0.4-0ubuntu5_amd64.deb) ...
Setting up vsftpd (2.0.4-0ubuntu5) ...
Adding system user `ftp' with uid 106...
Adding new user `ftp' (106) with group `nogroup'.
Not creating home directory `/home/ftp'.
* Starting FTP server: vsftpd
$ sudo vi /etc/vsftpd.conflocal_enable=YESwrite_enable=YESchroot_local_user=YES$ sudo /etc/init.d/vsftpd restart* Stopping FTP server: vsftpd [ ok ]
* Starting FTP server: vsftpd [ ok ]
$ ftp ftp.nixcraft.inConnected to ftp.nixcraft.in.
220 (vsFTPd 2.0.4)
Name (ftp.nixcraft.in:vivek): vivek
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> pwd
257 "/"
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rw-r--r-- 1 1000 1000 91798 Aug 16 08:26 apf-current.tar.gz
-rwxr-xr-x 1 1000 1000 156 Nov 10 07:05 iptables.stop
drwxr-xr-x 3 0 0 4096 Dec 23 11:11 postfix
-rw-r--r-- 1 0 0 10481942 Nov 29 23:35 webmin_1.310_all.deb
226 Directory send OK.
ftp> quit
221 Goodbye.
iptables -A INPUT -p tcp -m tcp --dport 21 -j ACCEPT$ man vsftpd.confapt-get install apache2updatedblocate mod_rewrite.socd /etc/apache2/mods-enabledtouch rewrite.loadvim rewrite.load (you may use any editor to edit this file)LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so/etc/apache2/sites-available/default
conf/httpd.confOptions Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from allOptions Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
/etc/init.d/apache2 restartroot@sumant:~# mkdir /home/www
root@sumant:~# mkdir /home/www/www.example.com
root@sumant:~# mkdir /home/www/www.example.com/htdocs
root@sumant:~# mkdir /home/www/www.example.com/cgi-bin
root@sumant:~# mkdir /home/www/www.example.com/logs
root@sumant:~# mkdir /home/www/www.example.net
root@sumant:~# mkdir /home/www/www.example.net/htdocs
root@sumant:~# mkdir /home/www/www.example.net/logs
root@sumant:~# mkdir /home/www/www.example.net/cgi-bin
root@sumant:~# mkdir /home/www/www.example.org
root@sumant:~# mkdir /home/www/www.example.org/htdocs
root@sumant:~# mkdir /home/www/www.example.org/logs
root@sumant:~# mkdir /home/www/www.example.org/cgi-bin
#
# We're running multiple virtual hosts.
#
NameVirtualHost *
/etc/apache2/sites-available
/etc/apache2/sites-enabled
#
# Example.com (/etc/apache2/sites-available/www.example.com)
#
<VirtualHost *>
ServerAdmin webmaster@example.com
ServerName www.example.com
ServerAlias example.com
# Indexes + Directory Root.
DirectoryIndex index.html
DocumentRoot /home/www/www.example.com/htdocs/
# CGI Directory
ScriptAlias /cgi-bin/ /home/www/www.example.com/cgi-bin/
<Location /cgi-bin>
Options +ExecCGI
</Location>
# Logfiles
ErrorLog /home/www/www.example.com/logs/error.log
CustomLog /home/www/www.example.com/logs/access.log combined
</VirtualHost>
#
# Example.net (/etc/apache2/sites-available/www.example.net)
#
<VirtualHost *>
ServerAdmin webmaster@example.net
ServerName www.example.net
ServerAlias example.net
# Indexes + Directory Root.
DirectoryIndex index.html
DocumentRoot /home/www/www.example.net/htdocs/
# CGI Directory
ScriptAlias /cgi-bin/ /home/www/www.example.net/cgi-bin/
<Location /cgi-bin>
Options +ExecCGI
</Location>
# Logfiles
ErrorLog /home/www/www.example.net/logs/error.log
CustomLog /home/www/www.example.net/logs/access.log combined
</VirtualHost>
#
# Example.org (/etc/apache2/sites-available/www.example.org)
#
<VirtualHost *>
ServerAdmin webmaster@example.org
ServerName www.example.org
ServerAlias example.org
# Indexes + Directory Root.
DirectoryIndex index.html
DocumentRoot /home/www/www.example.org/htdocs/
# CGI Directory
ScriptAlias /cgi-bin/ /home/www/www.example.org/cgi-bin/
<Location /cgi-bin>
Options +ExecCGI
</Location>
# Logfiles
ErrorLog /home/www/www.example.org/logs/error.log
CustomLog /home/www/www.example.org/logs/access.log combined
</VirtualHost>
root@sumant:~# a2ensite www.example.com
Site www.example.com installed; run /etc/init.d/apache2 reload to enable.
root@sumant:~# a2ensite www.example.net
Site www.example.net installed; run /etc/init.d/apache2 reload to enable.
root@sumant:~# a2ensite www.example.org
Site www.example.org installed; run /etc/init.d/apache2 reload to enable.
root@sumant:~# /etc/init.d/apache2 reload
Reloading web server config...done.
root@sumant:~#
sudo apt-get install bind9
sudo vi /etc/bind/named.conf.local
zone "example.com" {
type master;
file "/etc/bind/db.example.com";
};
sudo vi /etc/bind/example.com.db
;
; BIND data file for local loopback interface
;
$TTL 3600
@ IN SOA example.com. admin.example.com. (
11
604800
86400
2419200
604800 )
;
@ IN NS ns1.example.com.
@ IN A 192.168.0.1
ns1 IN A 192.168.0.1
ns2 IN A 192.168.0.1
www IN A 192.168.0.1
sudo /etc/init.d/bind9 restart
three steps to install sun jdk on ubuntu
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk
root: acl adsl-client apache at backup-config bacula-backup bandwidth bind8 burner cfengine change-user cluster-copy cluster-cron cluster-passwd cluster-shell cluster-software cluster-useradmin cluster-usermin cluster-webmin cpan cron custom dfsadmin dhcpd dnsadmin dovecot exim exports fdisk fetchmail file filter firewall frox fsdump grub heartbeat htaccess-htpasswd idmapd inetd init inittab ipfilter ipfw ipsec jabber krb5 ldap-client ldap-server ldap-useradmin lilo logrotate lpadmin lvm mailboxes mailcap majordomo man mon mount mysql net nis openslp package-updates pam pap passwd phpini postfix postgresql ppp-client pptp-client pptp-server procmail proc proftpd pserver qmailadmin quota raid samba sarg sendmail sentry servers shell shorewall smart-status smf software spam squid sshd status stunnel syslog syslog-ng system-status tcpwrappers telnet time tunnel updown useradmin usermin vgetty webalizer webminlog webmin wuftpd xinetd
newuser: cron webmin htaccess-passwd
debian:~# /usr/share/webmin/changepass.pl /etc/webmin newusername type_your_password
fedora:~# /usr/libexec/webmin/changepass.pl /etc/webmin/ newusername your_password
linux-shell:~# /etc/init.d/webmin restart