Difference between revisions of "Ubuntu OS"

From rbachwiki
Jump to navigation Jump to search
Line 47: Line 47:


</pre>
</pre>
== Working with users ==
== Linux User management ==
<p>command to Show all users:<br /> cat /etc/passwd <br /> lastlog</p>
<p>command to Show all users:<br /> cat /etc/passwd <br /> lastlog</p>
<table border="1" rules="ROWS">
<table border="1" rules="ROWS">
Line 327: Line 327:


</table>
</table>
== Updating Packages in Ubuntu Server ==
<ul style="text-align: left;">
<li>
<p><strong>Update the Package Index</strong>: The APT package index is essentially a database of available packages from the repositories defined in the <strong>/etc/apt/sources.list</strong> file. To update the local package index with the latest changes made in repositories, type the following:</p>
<blockquote class="yes"><strong>sudo apt-get update</strong></blockquote>
<p> </p>
</li>
<li>
<p><strong>Upgrade Packages</strong>: Over time, updated versions of packages currently installed on your computer may become available from the package repositories (for example security updated). To upgrade your system, first update your package index as outlined above, and then type:</p>
<blockquote class="yes"><strong>sudo apt-get upgrade</strong></blockquote>
<p> </p>
<p>If a package needs to install or remove new dependencies when being upgraded, it will not be upgraded by the <em>upgrade</em> command. For such an upgrade, it is necessary to use the dist-upgrade command.</p>
<p>Also, you may upgrade your entire Ubuntu system from one revision to another with dist-upgrade. For example, to upgrade from Ubuntu version 5.10 to version 6.06 LTS, you would first ensure the version 6.06 LTS repositories replace the existing 5.10 repositories in your computer's <strong>/etc/apt/sources.list</strong>, then simply issue the <strong>apt-get update</strong> command as detailed above, and finally, perform the actual upgrade by typing:</p>
<blockquote class="yes"><strong>sudo apt-get dist-upgrade</strong></blockquote>
<p> </p>
<p>After a fairly considerable amount of time, your computer will be upgraded to the new revision. Typically, some post-upgrade steps would be required as detailed in the upgrade notes for the revision you are upgrading to.</p>
<p>Actions of the <strong>apt-get</strong> command, such as installation and removal of packages, are logged in the /var/log/dpkg.log log file.</p>
</li>
<li>
<p><strong>Remove a Package</strong>: Removal of a package or packages is also a straightforward and simple process. To remove the nmap package installed in the previous example, type the following:</p>
<blockquote class="yes"><strong>sudo apt-get remove nmap</strong></blockquote>
<p> </p>
<p> </p>
<p><br /> Tip: <strong>Multiple Packages</strong>: You may specify multiple packages to be installed or removed, separated by spaces.</p>
</li>
</ul>

Revision as of 20:04, 5 August 2016

Allow port 3306 to be accessible externally

edit the /etc/mysql/my.cnf # the bind address which is usurally 127.0.0.1
 

Installing Bittorrent Sync

sh -c 'echo "deb http://linux-packages.getsync.com/btsync/deb btsync non-free" > /etc/apt/sources.list.d/btsync.list'
 
wget -qO - http://linux-packages.getsync.com/btsync/key.asc | sudo apt-key add - 
sudo apt-get update
 
sudo apt-get install btsync

Autostart Bitsync: add "Service btsync start" to the /etc/rc.local file

== How to Use BT sync:==

There’s already a few great tutorials about setting up Btsync in Ubuntu around the web. And below is a brief how-to:

First create a shared folder and set its permissions, here I created a folder shared_folder under the root of my current user:

cd && mkdir shared_folder

sudo chown YOUR_USER:btsync shared_folder

sudo chmod 2775 shared_folder

sudo usermod -a -G btsync YOUR_USER
Then start the btsync service:

sudo service btsync start
You may replace start with stop, enable, disable, or status to control Btsync.

Now go to localhost:8888 in your web browser and add the previous created folder:

Finally share the link, key, or QRcode with your friends and enjoy!

GuruPlug Server

 
Ip is set to DHCP at boot by a script. so even if you edit the /etc/interface file and add Static ip's it will change on reboot. In order to fix this this you need to edit the /etc/ifplugd/ifplugd.action file

and # dhclient3 -e IF_METRIC=100 -pf /var/run/dhclient.eth0.pid -lf /var/lib/dhcp3/dhclient.eth0.leases eth0 

line

Linux User management

command to Show all users:
cat /etc/passwd
lastlog

ac   Print statistics about users' connect time.
accton   Turn on accounting of processes. To turn it on type "accton /var/log/pacct".
adduser   Ex: adduser mark - Effect: Adds a user to the system named mark
chage   Used to change the time the user's password will expire.
chfn   Change the user full name field finger information
chgrp   Changes the group ownership of files.
chown   Change the owner of file(s ) to another user.
chpasswd   Update password file in batch.
chroot   Run command or interactive shell with special root directory.
chsh   Change the login shell.
edquota   Used to edit user or group quotas. This program uses the vi editor to edit the quota.user and quota.group files. If the environment variable EDITOR is set to emacs, the emacs editor will be used. Type "export EDITOR=emacs" to set that variable.
faillog   Examine faillog and set login failure limits.
finger   See what users are running on a system.
gpasswd   Administer the /etc/group file.
groupadd   Create a new group.
grpck   Verify the integrity of group files.
grpconv   Creates /etc/gshadow from the file /etc/group which converts to shadow passwords.
grpunconv   Uses the files /etc/passwd and /etc/shadow to create /etc/passwd, then deletes /etc/shadow which converts from shadow passwords.
groupdel   Delete a group.
groupmod   Modify a group.
groups   Print the groups a user is in
id   Print real and effective user id and group ids.
last   Display the last users logged on and how long.
lastb   Shows failed login attempts. This command requires the file /var/log/btmp to exist in order to work. Type "touch /var/log/btmp" to begin logging to this file.
lastcomm   Display information about previous commands in reverse order. Works only if process accounting is on.
lastlog   Formats and prints the contents of the last login.
logname   Print user's login name.
newgrp   Lets a suer log in to a new group.
newusers   Update and create newusers in batch.
passwd   Set a user's pass word.
pwck   Verify integrity of password files.
pwconv   Convert to and from shadow passwords and groups.
quota   Display users' limits and current disk usage.
quotaoff   Turns system quotas off.
quotaon   Turns system quotas on.
quotacheck   Used to check a filesystem for usage, and update the quota.user file.
repquota   Lists a summary of quota information on filesystems.
sa   Generates a summary of information about users' processes that are stored in the /var/log/pacct file.
smbclient   Works similar to an ftp client enabling the user to transfer files to and from a windows based computer.
smbmount   Allows a shared directory on a windows machine to be mounted on the Linux machine.
smbpasswd   Program to change users passwords for samba.
su   Ex: su mark - Effect: changes the user to mark, If not root will need marks password.
sulogin   Single user login.
ulimit   A bash builtin command for setting the processes a user can run.
useradd   Create a new user or update default new user information.
userdel   Delete a user account and related files.
usermod   Modify a user account.
users   Print the user names of users currently logged in.
utmpdump   Used for debugging.
vigr   Edit the password or group files.
vipw   Edit the password or group files.
w   Display users logged in and what they are doing.
wall   Send a message to everybody's terminal.
who   Display the users logged in.
whoami   Print effective user id.

Updating Packages in Ubuntu Server

  • Update the Package Index: The APT package index is essentially a database of available packages from the repositories defined in the /etc/apt/sources.list file. To update the local package index with the latest changes made in repositories, type the following:

    sudo apt-get update

     

  • Upgrade Packages: Over time, updated versions of packages currently installed on your computer may become available from the package repositories (for example security updated). To upgrade your system, first update your package index as outlined above, and then type:

    sudo apt-get upgrade

     

    If a package needs to install or remove new dependencies when being upgraded, it will not be upgraded by the upgrade command. For such an upgrade, it is necessary to use the dist-upgrade command.

    Also, you may upgrade your entire Ubuntu system from one revision to another with dist-upgrade. For example, to upgrade from Ubuntu version 5.10 to version 6.06 LTS, you would first ensure the version 6.06 LTS repositories replace the existing 5.10 repositories in your computer's /etc/apt/sources.list, then simply issue the apt-get update command as detailed above, and finally, perform the actual upgrade by typing:

    sudo apt-get dist-upgrade

     

    After a fairly considerable amount of time, your computer will be upgraded to the new revision. Typically, some post-upgrade steps would be required as detailed in the upgrade notes for the revision you are upgrading to.

    Actions of the apt-get command, such as installation and removal of packages, are logged in the /var/log/dpkg.log log file.

  • Remove a Package: Removal of a package or packages is also a straightforward and simple process. To remove the nmap package installed in the previous example, type the following:

    sudo apt-get remove nmap

     

     


    Tip: Multiple Packages: You may specify multiple packages to be installed or removed, separated by spaces.