CIS 228 - UNIX System Administration

Total Page:16

File Type:pdf, Size:1020Kb

CIS 228 - UNIX System Administration CIS 228 - UNIX System Administration Lab 9: Basic system administration - task, process, memory, daemon management, system activity Review process execution: fork, &, exec, . /command, Scheduling and running tasks “at” command (see also “batch”) Example: at now +1 minutes –f somecommandfile.txt 1) Login as user1 2) Read man page on “at” 3) echo ‘ echo hi there >> ~/attest.out ‘ > attest 4) chmod attest 755 5) at now + 1 minutes –f /home/user1/attest 6) atq, at-l, atrm, batch (interactive at) 7) as root, create at.deny entry for user1 (man at.deny) “cron” command: crontab –e (uses vi command set) 8) verify cron is running 9) crontab –e */1 * * * * echo “hi there” >> home/user1/attest.out 2>&1 10) crontab –l 11) cron.allow, cron.deny 12) alt F2, login as user1 13) see /etc/crontab Process management: “su” command 14) su –c ‘some root command’ “nohup” command 15) modify attest as follows: while [ true ] do sleep 15 echo hi there >> ~/attest.out done 16) nohup ./attest & 17) logoff user1. log back in 1 minute later. 18) ps -ef | grep attest Check nohup.out Lab 9: Basic system administration - task, process, daemon management, system activity “kill” command 19) ./attest & 20) ps 21) jobs 22) fg [job#] 23) Ctrl Z 24) bg [job#] 25) kill “attest pid” “nice” command 26) nice ./attest & “sudo” command 27) visudo user1 localhost=NOPASSWD:/sbin/halt - allow everyone to mount CDROMs on /mnt/cdrom deamon management 28) ps –ef 29) sysvinit: - service <name> stop/start - chkconfig <name> level 30) systemd: (see /etc/systemd) - systemctl list-units -t service --all - systemctl status ssh.service - systemctl start/stop sshd.service - systemctl enable/disable sshd.service - systemctl is-enabled sshd.service; echo $? - ps xawf -eo pid,user,cgroup,args –OR- systemd-cgls - systemctl kill sshd.service - systemctl kill -s HUP --kill-who=main crond.service - CHAGE – List/set user password and related details. See MAN page. 17) List user info: chage –-list username (or) chage -l username 18) Set password expiry date chage -M number-of-days username 19) Set account expiration date: chage -E "2009-05-31" username Lab 9: Basic system administration - task, process, memory, daemon management, system activity 20) Force the user account to be locked after X number of inactivity days chage -I 10 username 21) Disable password aging for an user account chage -m 0 -M 99999 -I -1 -E -1 username -m 0 will set the minimum number of days between password change to 0 -M 99999 will set the maximum number of days between password change to 99999 -I -1 (number minus one) will set the “Password inactive” to never -E -1 (number minus one) will set “Account expires” to never. 22) Lock/unlock an account passwd –l userid passwd –u userid 23) Limit password reuse: vi /etc/pam.d/system-auth (RHEL/Fedora) vi /etc/pam.d/common-password (Ubuntu) Add: password sufficient pam_unix.so use_authtok md5 shadow remember=10 24) Set a system wide session inactivity timeout: vi /etc/profile HOSTNAME=`/bin/hostname` HISTSIZE=1000 TMOUT=7200 (seconds) export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE TMOUT INPUTRC 25) Review /etc/shadow defaults in /etc/login.defs vi /etc/login.defs PASS_MAX_DAYS from 99999 to 90 PASS_MIN_DAYS from 0 to 1 Change PASS_MIN_LEN from 5 to 8 UMASK is set to 077 PASS_WARN_AGE 7 26) vi /etc/default/useradd INACTIVE 14 Number of days after password expiration that account is disabled. EXPIRE Account expiration date in the format YYYY-MM-DD. Lab 9: Basic system administration - task, process, daemon management, system activity System activity: yum install <service> which one for “top”? 31) top 32) ntop 33) iftop 34) iotop 35) htop 36) latencytop 37) free 38) iostat. iostat –c, iostat –d, iostat –n, iostat –m, iostat –p /dev/sda2, iostat –x /dev/sda2, iostat –L (LVM for later) 39) vmstat, vmstat –a, vmstat –d, vmstat –p /dev/sda2, vmstat –m, vmstat –s, vmstat –d, vmstat -2 10, vmstat –w 1 3, vmstat –S m 40) mpstat, mpstat –A, mpstat –P ALL, mpstat -0 -1 etc 41) pidstat 42) free 43) ps –aux | sort 44) ps –ef | sort System Activity Reporter (see /etc/cron.d/sysstat) 45) sar, sar –u, sar –u 1 3, sar –P ALL, sar –r 1 3, sar –S, sar –b, sar –d, sar –w, sar –q, sar –n 46) sa1 – generates daily binary stats to /var/log/sa/saXX sa2 – generate daily summary report to /var/log/sa/sarXX sar -q -f /var/log/sa/sa23 -s 10:00:01 – generate queue report for day 23 starting at 10AM 47) ulimit –a, see /etc/security/limits.conf ulimit –n, ulimit –Sn, ulimit -Hn 48) sysctl –q, see /etc/sysctl.conf sysctl -w See also anacron, /etc/crontab, /etc/anacrontab, systemd, nfsiostat, cifsiostat .
Recommended publications
  • Oracle® Linux 7 Monitoring and Tuning the System
    Oracle® Linux 7 Monitoring and Tuning the System F32306-03 October 2020 Oracle Legal Notices Copyright © 2020, Oracle and/or its affiliates. This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited. The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing. If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, then the following notice is applicable: U.S. GOVERNMENT END USERS: Oracle programs (including any operating system, integrated software, any programs embedded, installed or activated on delivered hardware, and modifications of such programs) and Oracle computer documentation or other Oracle data delivered to or accessed by U.S. Government end users are "commercial computer software" or "commercial computer software documentation" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, reproduction, duplication, release, display, disclosure, modification, preparation of derivative works, and/or adaptation of i) Oracle programs (including any operating system, integrated software, any programs embedded, installed or activated on delivered hardware, and modifications of such programs), ii) Oracle computer documentation and/or iii) other Oracle data, is subject to the rights and limitations specified in the license contained in the applicable contract.
    [Show full text]
  • Pingdirectory Administration Guide Version
    Release 7.3.0.3 Server Administration Guide PingDirectory | Contents | ii Contents PingDirectory™ Product Documentation................................................ 20 Overview of the Server............................................................................. 20 Server Features.................................................................................................................................20 Administration Framework.................................................................................................................21 Server Tools Location....................................................................................................................... 22 Preparing Your Environment....................................................................22 Before You Begin.............................................................................................................................. 22 System requirements..............................................................................................................22 Installing Java......................................................................................................................... 23 Preparing the Operating System (Linux).......................................................................................... 24 Configuring the File Descriptor Limits.................................................................................... 24 File System Tuning.................................................................................................................25
    [Show full text]
  • Linux Performance Tools
    Linux Performance Tools Brendan Gregg Senior Performance Architect Performance Engineering Team [email protected] @brendangregg This Tutorial • A tour of many Linux performance tools – To show you what can be done – With guidance for how to do it • This includes objectives, discussion, live demos – See the video of this tutorial Observability Benchmarking Tuning Stac Tuning • Massive AWS EC2 Linux cloud – 10s of thousands of cloud instances • FreeBSD for content delivery – ~33% of US Internet traffic at night • Over 50M subscribers – Recently launched in ANZ • Use Linux server tools as needed – After cloud monitoring (Atlas, etc.) and instance monitoring (Vector) tools Agenda • Methodologies • Tools • Tool Types: – Observability – Benchmarking – Tuning – Static • Profiling • Tracing Methodologies Methodologies • Objectives: – Recognize the Streetlight Anti-Method – Perform the Workload Characterization Method – Perform the USE Method – Learn how to start with the questions, before using tools – Be aware of other methodologies My system is slow… DEMO & DISCUSSION Methodologies • There are dozens of performance tools for Linux – Packages: sysstat, procps, coreutils, … – Commercial products • Methodologies can provide guidance for choosing and using tools effectively • A starting point, a process, and an ending point An#-Methodologies • The lack of a deliberate methodology… Street Light An<-Method 1. Pick observability tools that are: – Familiar – Found on the Internet – Found at random 2. Run tools 3. Look for obvious issues Drunk Man An<-Method • Tune things at random until the problem goes away Blame Someone Else An<-Method 1. Find a system or environment component you are not responsible for 2. Hypothesize that the issue is with that component 3. Redirect the issue to the responsible team 4.
    [Show full text]
  • UNIX OS Agent User's Guide
    IBM Tivoli Monitoring Version 6.3.0 UNIX OS Agent User's Guide SC22-5452-00 IBM Tivoli Monitoring Version 6.3.0 UNIX OS Agent User's Guide SC22-5452-00 Note Before using this information and the product it supports, read the information in “Notices” on page 399. This edition applies to version 6, release 3 of IBM Tivoli Monitoring (product number 5724-C04) and to all subsequent releases and modifications until otherwise indicated in new editions. © Copyright IBM Corporation 1994, 2013. US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Contents Tables ...............vii Solaris System CPU Workload workspace ....28 Solaris Zone Processes workspace .......28 Chapter 1. Using the monitoring agent . 1 Solaris Zones workspace ..........28 System Details workspace .........28 New in this release ............2 System Information workspace ........29 Components of the monitoring agent ......3 Top CPU-Memory %-VSize Details workspace . 30 User interface options ...........4 UNIX OS workspace ...........30 UNIX Detail workspace ..........31 Chapter 2. Requirements for the Users workspace ............31 monitoring agent ...........5 Enabling the Monitoring Agent for UNIX OS to run Chapter 4. Attributes .........33 as a nonroot user .............7 Agent Availability Management Status attributes . 36 Securing your IBM Tivoli Monitoring installation 7 Agent Active Runtime Status attributes .....37 Setting overall file ownership and permissions for AIX AMS attributes............38
    [Show full text]
  • Nxadmin CLI Reference Guide Unity Iv Contents
    HYPER-UNIFIED STORAGE nxadmin Command Line Interface Reference Guide NEXSAN | 325 E. Hillcrest Drive, Suite #150 | Thousand Oaks, CA 91360 USA Printed Thursday, July 26, 2018 | www.nexsan.com Copyright © 2010—2018 Nexsan Technologies, Inc. All rights reserved. Trademarks Nexsan® is a trademark or registered trademark of Nexsan Technologies, Inc. The Nexsan logo is a registered trademark of Nexsan Technologies, Inc. All other trademarks and registered trademarks are the property of their respective owners. Patents This product is protected by one or more of the following patents, and other pending patent applications worldwide: United States patents US8,191,841, US8,120,922; United Kingdom patents GB2466535B, GB2467622B, GB2467404B, GB2296798B, GB2297636B About this document Unauthorized use, duplication, or modification of this document in whole or in part without the written consent of Nexsan Corporation is strictly prohibited. Nexsan Technologies, Inc. reserves the right to make changes to this manual, as well as the equipment and software described in this manual, at any time without notice. This manual may contain links to web sites that were current at the time of publication, but have since been moved or become inactive. It may also contain links to sites owned and operated by third parties. Nexsan is not responsible for the content of any such third-party site. Contents Contents Contents iii Chapter 1: Accessing the nxadmin and nxcmd CLIs 15 Connecting to the Unity Storage System using SSH 15 Prerequisite 15 Connecting to the Unity
    [Show full text]
  • Cisco Identity Services Engine CLI Reference Guide, Release 2.2 Americas Headquarters Cisco Systems, Inc
    Cisco Identity Services Engine CLI Reference Guide, Release 2.2 Americas Headquarters Cisco Systems, Inc. 170 West Tasman Drive San Jose, CA 95134-1706 USA http://www.cisco.com Tel: 408 526-4000 800 553-NETS (6387) Fax: 408 527-0883 THE SPECIFICATIONS AND INFORMATION REGARDING THE PRODUCTS IN THIS MANUAL ARE SUBJECT TO CHANGE WITHOUT NOTICE. ALL STATEMENTS, INFORMATION, AND RECOMMENDATIONS IN THIS MANUAL ARE BELIEVED TO BE ACCURATE BUT ARE PRESENTED WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. USERS MUST TAKE FULL RESPONSIBILITY FOR THEIR APPLICATION OF ANY PRODUCTS. THE SOFTWARE LICENSE AND LIMITED WARRANTY FOR THE ACCOMPANYING PRODUCT ARE SET FORTH IN THE INFORMATION PACKET THAT SHIPPED WITH THE PRODUCT AND ARE INCORPORATED HEREIN BY THIS REFERENCE. IF YOU ARE UNABLE TO LOCATE THE SOFTWARE LICENSE OR LIMITED WARRANTY, CONTACT YOUR CISCO REPRESENTATIVE FOR A COPY. The Cisco implementation of TCP header compression is an adaptation of a program developed by the University of California, Berkeley (UCB) as part of UCB's public domain version of the UNIX operating system. All rights reserved. Copyright © 1981, Regents of the University of California. NOTWITHSTANDING ANY OTHER WARRANTY HEREIN, ALL DOCUMENT FILES AND SOFTWARE OF THESE SUPPLIERS ARE PROVIDED “AS IS" WITH ALL FAULTS. CISCO AND THE ABOVE-NAMED SUPPLIERS DISCLAIM ALL WARRANTIES, EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, THOSE OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OR ARISING FROM A COURSE OF DEALING, USAGE, OR TRADE PRACTICE. IN NO EVENT SHALL CISCO OR ITS SUPPLIERS BE LIABLE FOR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, OR INCIDENTAL DAMAGES, INCLUDING, WITHOUT LIMITATION, LOST PROFITS OR LOSS OR DAMAGE TO DATA ARISING OUT OF THE USE OR INABILITY TO USE THIS MANUAL, EVEN IF CISCO OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
    [Show full text]
  • SUSE Linux Enterprise Server 11 SP4 System Analysis and Tuning Guide System Analysis and Tuning Guide SUSE Linux Enterprise Server 11 SP4
    SUSE Linux Enterprise Server 11 SP4 System Analysis and Tuning Guide System Analysis and Tuning Guide SUSE Linux Enterprise Server 11 SP4 Publication Date: September 24, 2021 SUSE LLC 1800 South Novell Place Provo, UT 84606 USA https://documentation.suse.com Copyright © 2006– 2021 SUSE LLC and contributors. All rights reserved. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or (at your option) version 1.3; with the Invariant Section being this copyright notice and license. A copy of the license version 1.2 is included in the section entitled “GNU Free Documentation License”. For SUSE trademarks, see http://www.suse.com/company/legal/ . All other third party trademarks are the property of their respective owners. A trademark symbol (®, ™ etc.) denotes a SUSE or Novell trademark; an asterisk (*) denotes a third party trademark. All information found in this book has been compiled with utmost attention to detail. However, this does not guarantee complete accuracy. Neither SUSE LLC, its aliates, the authors nor the translators shall be held liable for possible errors or the consequences thereof. Contents About This Guide xi 1 Available Documentation xii 2 Feedback xiv 3 Documentation Conventions xv I BASICS 1 1 General Notes on System Tuning 2 1.1 Be Sure What Problem to Solve 2 1.2 Rule Out Common Problems 3 1.3 Finding the Bottleneck 3 1.4 Step-by-step Tuning 4 II SYSTEM MONITORING 5 2 System Monitoring Utilities 6 2.1 Multi-Purpose Tools 6 vmstat 7
    [Show full text]
  • System Analysis and Tuning Guide System Analysis and Tuning Guide SUSE Linux Enterprise Server 15 SP1
    SUSE Linux Enterprise Server 15 SP1 System Analysis and Tuning Guide System Analysis and Tuning Guide SUSE Linux Enterprise Server 15 SP1 An administrator's guide for problem detection, resolution and optimization. Find how to inspect and optimize your system by means of monitoring tools and how to eciently manage resources. Also contains an overview of common problems and solutions and of additional help and documentation resources. Publication Date: September 24, 2021 SUSE LLC 1800 South Novell Place Provo, UT 84606 USA https://documentation.suse.com Copyright © 2006– 2021 SUSE LLC and contributors. All rights reserved. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or (at your option) version 1.3; with the Invariant Section being this copyright notice and license. A copy of the license version 1.2 is included in the section entitled “GNU Free Documentation License”. For SUSE trademarks, see https://www.suse.com/company/legal/ . All other third-party trademarks are the property of their respective owners. Trademark symbols (®, ™ etc.) denote trademarks of SUSE and its aliates. Asterisks (*) denote third-party trademarks. All information found in this book has been compiled with utmost attention to detail. However, this does not guarantee complete accuracy. Neither SUSE LLC, its aliates, the authors nor the translators shall be held liable for possible errors or the consequences thereof. Contents About This Guide xii 1 Available Documentation xiii
    [Show full text]
  • SQL Server on Linux Fundamentals for Dbas
    [email protected] Choice Containers Supported Platform version(s) Red Hat Enterprise Linux 7.3 or 7.4 SUSE Linux Enterprise Server v12 SP2 Ubuntu 16.04 Docker Engine 1.8+ Command What it does man Manual – help files for a command grep Filter info from first data - sort of like POSH | pwd Present Working Directory – shows where you are cd Change directory ls List files in a directory cat Concatenate chmod Change directory or file read/write permissions chown Change directory or file owner systemctl Tool for controlling the init system – start and stop services File and folder permissions rwxr-xr-x sudo systemctl restart mssql-server / root (equivalent of C:\) /bin system binaries /dev devices /etc host-specific system-wide config files /home/username user's directory /opt optional software packages - like SQL Server /var files with frequently varying content – like data and log files SQL Server 2019 preview and RC Preview (2019) mssql-server-preview repository. CU - base package + bug SQL Server 2017 Cumulative Update fixes mssql-server-2017 (CU) repository. GDR - base package + critical SQL Server 2017 GDR repository for fixes/security updates mssql-server-2017-gdr critical updates only. sudo dpkg -i mssql-server_versionnumber_amd64.deb sqlcmd -S localhost -U <username> -P <password> sudo cat /var/opt/mssql/mssql.conf sudo /opt/mssql/bin/mssql-conf set sqlagent.enabled true Enable SQL Server Agent Change default file directories Enable Availability Groups Set the memory limit for SQL Server Set trace flags ...and more df file system
    [Show full text]
  • Unix and Linux System Administration and Shell Programming
    Unix and Linux System Administration and Shell Programming Unix and Linux System Administration and Shell Programming version 56 of August 12, 2014 Copyright © 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012, 2013, 2014 Milo This book includes material from the http://www.osdata.com/ website and the text book on computer programming. Distributed on the honor system. Print and read free for personal, non-profit, and/or educational purposes. If you like the book, you are encouraged to send a donation (U.S dollars) to Milo, PO Box 5237, Balboa Island, California, USA 92662. This is a work in progress. For the most up to date version, visit the website http://www.osdata.com/ and http://www.osdata.com/programming/shell/unixbook.pdf — Please add links from your website or Facebook page. Professors and Teachers: Feel free to take a copy of this PDF and make it available to your class (possibly through your academic website). This way everyone in your class will have the same copy (with the same page numbers) despite my continual updates. Please try to avoid posting it to the public internet (to avoid old copies confusing things) and take it down when the class ends. You can post the same or a newer version for each succeeding class. Please remove old copies after the class ends to prevent confusing the search engines. You can contact me with a specific version number and class end date and I will put it on my website. version 56 page 1 Unix and Linux System Administration and Shell Programming Unix and Linux Administration and Shell Programming chapter 0 This book looks at Unix (and Linux) shell programming and system administration.
    [Show full text]
  • Analysis of P4 and XDP for Iot Programmability in 6G and Beyond
    IoT Article Analysis of P4 and XDP for IoT Programmability in 6G and Beyond David Carrascal 1,† , Elisa Rojas 1,*,† , Joaquin Alvarez-Horcajo 1,† , Diego Lopez-Pajares 2 and Isaías Martínez-Yelmo 1 1 Departamento de Automática, Escuela Politécnica Superior, University of Alcala, 28801 Alcalá de Henares, Spain; [email protected] (D.C.); [email protected] (J.A.-H.); [email protected] (I.M.-Y.) 2 Departamento de Ingeniería de Sistemas Telemáticos, E.T.S de Ingenieros de Telecomunicación, Technical University of Madrid, 28040 Madrid, Spain; [email protected] * Correspondence: [email protected] † These authors contributed equally to this work. Received: 19 November 2020; Accepted: 10 December 2020; Published: 15 December 2020 Abstract: Recently, two technologies have emerged to provide advanced programmability in Software-Defined Networking (SDN) environments, namely P4 and XDP. At the same time, the Internet of Things (IoT) represents a pillar of future 6G networks, which will be also sustained by SDN. In this regard, there is a need to analyze the suitability of P4 and XDP for IoT. In this article, we aim to compare both technologies to help future research efforts in the field. For this purpose, we evaluate both technologies by implementing diverse use cases, assessing their performance and providing a quick qualitative overview. All tests and design scenarios are publicly available in GitHub to guarantee replication and serve as initial steps for researchers that want to initiate in the field. Results illustrate that currently XDP is the best option for constrained IoT devices, showing lower latency times, half the CPU usage, and reduced memory in comparison with P4.
    [Show full text]
  • SUSE Linux Enterprise Server 12 SP4 System Analysis and Tuning Guide System Analysis and Tuning Guide SUSE Linux Enterprise Server 12 SP4
    SUSE Linux Enterprise Server 12 SP4 System Analysis and Tuning Guide System Analysis and Tuning Guide SUSE Linux Enterprise Server 12 SP4 An administrator's guide for problem detection, resolution and optimization. Find how to inspect and optimize your system by means of monitoring tools and how to eciently manage resources. Also contains an overview of common problems and solutions and of additional help and documentation resources. Publication Date: September 24, 2021 SUSE LLC 1800 South Novell Place Provo, UT 84606 USA https://documentation.suse.com Copyright © 2006– 2021 SUSE LLC and contributors. All rights reserved. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or (at your option) version 1.3; with the Invariant Section being this copyright notice and license. A copy of the license version 1.2 is included in the section entitled “GNU Free Documentation License”. For SUSE trademarks, see https://www.suse.com/company/legal/ . All other third-party trademarks are the property of their respective owners. Trademark symbols (®, ™ etc.) denote trademarks of SUSE and its aliates. Asterisks (*) denote third-party trademarks. All information found in this book has been compiled with utmost attention to detail. However, this does not guarantee complete accuracy. Neither SUSE LLC, its aliates, the authors nor the translators shall be held liable for possible errors or the consequences thereof. Contents About This Guide xii 1 Available Documentation xiii
    [Show full text]