There are two tools with which you should be familiar: the program su, and more importantly, sudo. Here we see how to use them.

Similar documents
Introduction to Unix May 24, 2008

NETW 110 Lab 3 Post-Installation Configuration Page 1

Lab 3a Using the vi editor

Introduction to Security in Laserfiche 8.3 and later. White Paper

Message Networking 5.2 Administration print guide

Xton Access Manager GETTING STARTED GUIDE

9.2 Linux Essentials Exam Objectives

Unix/Linux Basics. Cpt S 223, Fall 2007 Copyright: Washington State University

ANDROID PRIVACY & SECURITY GUIDE ANDROID DEVICE SETTINGS

Permissions and Links

TECH 4272 Operating Systems

Identity, Authentication, and Access Control

BRIVO ONSITE QUICK START GUIDE 09/14/17

Using RANCID. Contents. 1 Introduction Goals Notes Install rancid Add alias Configure rancid...

14. Configuring Telnet in Knoppix

Examples of Cisco APE Scenarios

CS/CIS 249 SP18 - Intro to Information Security

CSE 390a Lecture 3. Multi-user systems; remote login; editors; users/groups; permissions

TEL2821/IS2150: INTRODUCTION TO SECURITY Lab: Operating Systems and Access Control

How to Secure SSH with Google Two-Factor Authentication

Using the Zoo Workstations

Placement Environment Profile (PEP) Complete User Guide View and Edit

VISUDO(8) System Manager s Manual VISUDO(8)

Aliases are set manually or in a login script. Aliases that were set manually will be gone the next time you login.

#Uncomment the second line to enable any form of FTP write command. #write_enable=yes

Operating systems and security - Overview

Operating systems and security - Overview

COMS 6100 Class Notes 3

Sudo: Switch User Do. Administrative Privileges Delegation Campus-Booster ID : **XXXXX. Copyright SUPINFO. All rights reserved

Information System Audit Engr. Abdul-Rahman Mahmood MS, PMP, MCP, QMR(ISO9001:2000)

Perl and R Scripting for Biologists

NETW 110 Lab 5 Creating and Assigning Users and Groups Page 1

Week - 01 Lecture - 04 Downloading and installing Python

Linux basics U3A in Bath. Linux Principles. by Andy Pepperdine

maxecurity Product Suite

CSE 265: System and Network Administration

Use Cases for Unix & Linux

Optional Labs. 0Handouts: 2002 ProsoftTraining All Rights Reserved. Version 3.07

Placement Environment Profile (PEP) Complete User Guide View and Edit

UNIX files searching, and other interrogation techniques

HANDS UP IF YOU DON T HAVE A VM OR IF YOU DON T REMEMBER YOUR PASSWORDS. Or something broke

Exercise Sheet 2. (Classifications of Operating Systems)

Linux Systems Administration Getting Started with Linux

VISUDO(8) System Manager s Manual VISUDO(8)

Table of Contents. Overview of the TEA Login Application Features Roles in Obtaining Application Access Approval Process...

More Raspian. An editor Configuration files Shell scripts Shell variables System admin

Ticketing Service 1 Request Tracker (RT) Installation and Configuration

Protocols. Module UFCE Topic: Protocols and More HTML

CS 1110, LAB 3: MODULES AND TESTING First Name: Last Name: NetID:

h/w m/c Kernel shell Application s/w user

COMP2100/2500 Lecture 17: Shell Programming II

Using grub to Boot various Operating Systems

Managing Users, Managing Security

Exploring UNIX: Session 3

UNIT 9 Introduction to Linux and Ubuntu

5 Managing Logins. For Help. In this Chapter... Login Account Concepts, 5-2

Introduction to Linux for BlueBEAR. January

2 Initialize a git repository on your machine, add a README file, commit and push

The kernel is the low-level software that manages hardware, multitasks programs, etc.

CHE3935. Lecture 1. Introduction to Linux

A Brief Introduction to the Linux Shell for Data Science

Due: October 8, 2013: 7.30 PM

Introduction to UNIX. Logging in. Basic System Architecture 10/7/10. most systems have graphical login on Linux machines

oit

Exam : Title : Linux Security. Version : DEMO

Oregon State University School of Electrical Engineering and Computer Science. CS 261 Recitation 1. Spring 2011

Physics REU Unix Tutorial

SANOG VI IP Services Workshop: FreeBSD Install

Amazon Web Services Hands On S3 January, 2012

BPPM Patrol Agent Installation Steps on Linux and Automation Integration

User & Group Administration

Access Control. CMPSC Spring 2012 Introduction Computer and Network Security Professor Jaeger.

Your Mission: Connect to a remote Linux target(s) disk using F-Response Consultant Edition.

Basics. I think that the later is better.

Introduction to Information Security Prof. V. Kamakoti Department of Computer Science and Engineering Indian Institute of Technology, Madras

CSCI 2132 Software Development. Lecture 3: Unix Shells and Other Basic Concepts

User accounts and authorization

Review of Fundamentals. Todd Kelley CST8207 Todd Kelley 1

HelpAndManual_illegal_keygen Contactor Elite Autoresponder Installation Guide

Files.Kennesaw.Edu. Kennesaw State University Information Technology Services. Introduces. Presented by the ITS Technology Outreach Team

Course Wiki. Today s Topics. Web Resources. Amazon EC2. Linux. Apache PHP. Workflow and Tools. Extensible Networking Platform 1

ssh and handson Matsuzaki maz Yoshinobu 1

9 and 11-Jan CSCI 4152/6509 Natural Language Processing Lab 1: FCS Computing Environment, SVN Tutorial. FCS Computing Environment, SVN Tutorial

The Ultimate Linux/Windows System

Part I. Introduction to Linux

Lab 1: Getting Started with Linux The Extremely Illustrated Version. Graham Northup

Editors in Unix come in two general flavours:

Setting up the Seagate D4 NAS with Hard Disk Sentinel Pro. By Gary Ryan. Adapted from:

Linux Home Lab Environment

Basics of Stata, Statistics 220 Last modified December 10, 1999.

VOCAL. Video Optical Comparison and Logging. User Guide

Exim Practical. Patrick Okui. (based on materials from Brian Candler)

Logic Pro 7.1 Personal Manual by Edgar Rothermich <

Spring 2017 Gabriel Kuri

Jackson State University Department of Computer Science CSC / Computer Security Fall 2013 Instructor: Dr. Natarajan Meghanathan

Commands are in black

One of the fundamental kinds of websites that SharePoint 2010 allows

TEL2821/IS2150: INTRODUCTION TO SECURITY Lab: Operating Systems and Access Control

Lab 5a Shell Script Lab 4 Using Arithmetic Operators in shell script

Chapter 5: User Management. Chapter 5 User Management

Transcription:

Operating Systems and Systems Integration Administration, the root User and Configuring sudo 1 Aim The aim of this activity is to understand the purpose of the root account, and the security risks of logging in as root, and how to avoid them. The student will appreciate that system administration with sudo is a useful help to security. 2 Background You normally log into the computer system as your own user account. There are only two places where you can create or edit files on the computer system: in your home directory; in the /tmp directory. Everywhere else is read only, or offers you no access. However, to perform system administration, you sometimes need to change files outside of your home directory, and outside of the /tmp directory. How can you perform system administration? You need to temporarily become the root user. The root user account is sometimes called the superuser, since this account allows access to everything. This power is too great for most activities; with a simple typing mistake, you can delete the entire hard disk. Viruses and worms running under the root account can damage anywhere at all, and have access to everything on the computer. Buggy software running as the root user can do unlimited damage. Running all software as the root user is an accident waiting to happen. It is like using a chainsaw to cut a loaf of bread. Figure 1: Doing everything as root is like cutting bread with a chainsaw. There are two tools with which you should be familiar: the program su, and more importantly, sudo. Here we see how to use them. 3 Procedure 3.1 Using the su Program to Become root 1. Log into your Linux system with your own user account, not as root. 2. In a terminal window, type: $ su -

Operating Systems and Systems Integration 2 Do not type the $; that indicates the prompt, and that you are typing this as a normal user. When you log in as root, the prompt becomes a hash:. The minus sign - tells su to run the login scripts of the user you are changing to (here, it is the root user). 3. When prompted, type in your root password (note, this is different from sudo). 4. Notice that your prompt has changed to a hash:. 5. To run graphical programs (an example is xclock), you may need to type in another terminal window (or the same one before you type the su command) the following command: $ xhost +localhost 6. To exit (log out) from the root account, type: exit 3.2 Advantages and Disadvantages of Using the su Program There is quite a lot of convenience in opening one window, suing to root, and leaving that window open. However, when you go to get that cup of tea, someone else may come and take advantage of this. The person who uses su must also know the root password. The more people who know a secret, the less of a secret it is. It is more secure to use the program sudo, which we discuss now. 3.3 The sudo Program The sudo program allows a senior system administrator to keep the root password to themselves, and to delegate responsibility for various tasks to other junior system administators. There are some advantages to doing things this way, including the fact that every command executed using sudo is recorded in the system logs. This can help administrators coordinate their efforts; they can see what the other has done. Also, a cracker who breaks into the system and who gets access to the root account will beunlikely to use sudo, and the break-in will be clearly visible in the system logs (unless the person is smart enough to cover their tracks). Probably the most important thing is that the administrator does not need to know or remember the root password, thus making it easier to keep secret, and allowing it to be changed more often. 3.4 Configuring sudo 1. Become root using the su program, as described above in section 3.1 on the preceding page. 2. Type: visudo 3. Refer to the chapter about vi in the Linux Workshop notes for guidance on using the vi text editor. You will find the o and i commands useful.

Operating Systems and Systems Integration 3 4. Or, if you prefer emacs to vi like I do, then you could type: EDITOR=emacs visudo 5. Edit the file so that it looks like this, taking care to type it accurately, but put your username instead of mine: sudoers file. This file MUST be edited with the visudo command as root. See the sudoers man page for the details on how to write a sudoers file. Defaults timestamp_timeout = 10 Host alias specification User alias specification Cmnd alias specification User privilege specification root ALL=(ALL) ALL nicku ALL=(ALL) ALL Note that two lines were added, nothing else is changed. But please use your own ldap user name here, not nicku! See man sudoers and search for Defaults, and also timeout for information about the first line. It changes the time that may elapse since you last used sudo before you need to enter your password again. The default is normally five minutes. 6. Save it and exit by typing (in vi): Esc :wq and sudo is now configured. Here we have assigned full priveleges to the user, but sudo can be set up to assign restricted administration rights to junior administrators. You can learn more by reading the man (manual) pages for sudoers, sudo and visudo. 7. Log out from being root by typing: exit Your prompt should end with a dollar; if not, then you have run su - more than once. Continue typing exit until your prompt ends with a dollar: $.

Operating Systems and Systems Integration 4 3.5 Using Sudo 3.5.1 Some Background To use sudo, 1. you type sudo in front of the command you want to execute as the root user. 2. The first time you do this, you will see a warning like this: We trust you have received the usual lecture from the local System Administrator. It usually boils down to these two things: Password: 1) Respect the privacy of others. 2) Think before you type. 3. At that prompt, you will type your own password, not that of the root user. 4. If you use sudo within the next ten minutes (normally five) within the same terminal window, you will not need to type your password. 5. If you walk away from your computer at all, you can cause the ten minute period to expire immediately by typing: $ sudo -k If sudo is used immediately after this, a passsword will be required. 6. Before running a graphical program with sudo for the first time in one login session, you need to type (as your own self): $ xhost +localhost to allow any user who is logged into your machine, to display graphics on the X server (the network graphics system on which you run your graphical user interface). This includes the user root, who is otherwise barred from display while you are running X from your account. 3.5.2 Exercise using sudo 1. Try to display the special log file /var/log/secure: $ cat /var/log/secure cat: /var/log/secure: Permission denied Hmm, it says permission is denied. Only system administrators can see this log file. Let s use sudo: $ sudo cat /var/log/secure Make sure you enter your own password, and not that of root.

Operating Systems and Systems Integration 5 3.6 Why Use sudo? There are four main reasons for using sudo: Only one person needs to know the root password. A secret shared between ten system administrators is no longer a secret. You only run as root the commands that you need to run as root. This increases security significantly. The less you do at the highest privelege level, the better. A senior system administrator may delegate only some duties to others (i.e., backup, printing administration,... ), since sudo allows the senior administrator to allow priveleged access to only the required commands. Every command executed using sudo is recorded in a log file. On Red Hat 9, this is /var/log/security. For each command executed using sudo, the following details are recorded: The time the command was executed The user who executed the command What user the command was effectively executed as (usually root, but you can change that with the -u user option to sudo see man sudo). What the current directory was that the command was executed in What terminal was used (i.e., was the user logged in locally, or over the network?) The exact command, with its exact location in the file system. This log allows the system administrator to go back and find out what was done when by who. If the system stops working properly, the logs can provide information about what was done at the time, and if a mistake was made, it can be identified and rectified. 3.7 Warning! From now on, if I see anyone logged in as the root user into the X Window system, I will make a mental note of this person as being a poor student, and I will then take careful note of any other poor behaviour! Seriously, it is very amateur behaviour to remain consistently logged into an X Window system as the root user. If I catch you doing this, expect a stern warning. Similarly, I do not want to see you using a window sued to root for extended periods of time, and I will similarly criticise you for doing so. Such behaviour leaves the system open to security abuse by others. I want all of you to get into the habit of using sudo for system administration tasks. You will be a better system administrator for this, and your system will be less easy to crack. Note that at your workplace, you should ensure that the number of people who can use sudo on the system you are responsible for is limited as much as possible.