{"id":22239,"date":"2016-05-26T03:01:28","date_gmt":"2016-05-25T17:01:28","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=22239"},"modified":"2016-06-19T21:04:45","modified_gmt":"2016-06-19T11:04:45","slug":"mac-os-x-users-and-groups-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/mac-os-x-users-and-groups-primer-tutorial\/","title":{"rendered":"Mac OS X Users and Groups Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Mac\/mac_users_groups.jpg\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Mac OS X Users and Groups Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Mac\/mac_users_groups.jpg\" title=\"Mac OS X Users and Groups Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Mac OS X Users and Groups Primer Tutorial<\/p><\/div>\n<p>Underpinning a Mac OS X MacBook Pro laptop&#8217;s workings is a Linux or Unix-like BSD operating system.  This operating system, like a lot of others, uses files that have permissions and ownership.<\/p>\n<p>If you have file permissions they are for &#8230;<\/p>\n<ol>\n<li>read<\/li>\n<li>write<\/li>\n<li>execute<\/li>\n<\/ol>\n<p> &#8230; with respect to the file access right categories &#8230;<\/p>\n<ol>\n<li>system<\/li>\n<li>owner<\/li>\n<li>group<\/li>\n<li>world<\/li>\n<\/ol>\n<p> &#8230; and so you have command line commands &#8230;<\/p>\n<ol>\n<li><code><br \/>\nNAME<br \/>\n     chown -- change file owner and group<\/p>\n<p>SYNOPSIS<br \/>\n     chown [-fhv] [-R [-H | -L | -P]] owner[:group] file ...<br \/>\n     chown [-fhv] [-R [-H | -L | -P]] :group file ...<br \/>\n<\/code><\/li>\n<li><code><br \/>\nNAME<br \/>\n     chgrp -- change group<\/p>\n<p>SYNOPSIS<br \/>\n     chgrp [-fhv] [-R [-H | -L | -P]] group file ...<br \/>\n<\/code><\/li>\n<li><code><br \/>\nNAME<br \/>\n     chmod -- change file modes or Access Control Lists<\/p>\n<p>SYNOPSIS<br \/>\n     chmod [-fv] [-R [-H | -L | -P]] mode file ...<br \/>\n     chmod [-fv] [-R [-H | -L | -P]] [-a | +a | =a] ACE file ...<br \/>\n     chmod [-fhv] [-R [-H | -L | -P]] [-E] file ...<br \/>\n     chmod [-fhv] [-R [-H | -L | -P]] [-C] file ...<br \/>\n     chmod [-fhv] [-R [-H | -L | -P]] [-N] file ...<br \/>\n<\/code><\/li>\n<\/ol>\n<p> &#8230; to help control how files are accessed by users and their underlying group &#8220;membership&#8221;.<\/p>\n<p>So, what about create Users and Groups in the first place with Mac OS X?  Well, you can do it using the command line, but in this case we think to use the Mac OS X Apple -&gt; System Preferences -&gt; Users and Groups GUI interface, as much as anything, because you can visualize the relationships better in a GUI arrangement, for this.<\/p>\n<p>So for today&#8217;s <a target=_blank title='Tutorial picture' href='http:\/\/www.rjmprogramming.com.au\/Mac\/mac_users_groups.jpg'>tutorial picture<\/a> example we, that being the administrator user &#8216;pgAgent&#8217;, create &#8230;<\/p>\n<ul>\n<li>new group called &#8216;applications&#8217;<\/li>\n<li>new user called &#8216;jenkins&#8217; (with administrative rights) with group &#8216;applications&#8217;<\/li>\n<\/ul>\n<p> &#8230; and once a restart &#8220;cements&#8221; this into place, you will then be able to access user &#8216;jenkins&#8217; at either &#8230;<\/p>\n<ol>\n<li>login screen &#8216;jenkins&#8217; (new) button<\/li>\n<li>at the command line via &#8230;<br \/>\n<code><br \/>\nNAME<br \/>\n     su -- substitute user identity<\/p>\n<p>SYNOPSIS<br \/>\n     su [-] [-flm] [login [args]]<br \/>\n<\/code><\/p>\n<p>Also of interest to administrator users (where the <i>system<\/i> file access category applies) is the command &#8230;<\/p>\n<p><code><br \/>\nNAME<br \/>\n       sudo - execute a command as another user<\/p>\n<p>SYNOPSIS<br \/>\n       sudo -h | -K | -k | -L | -V<\/p>\n<p>       sudo -v [-AknS] [-g group name|#gid] [-p prompt] [-u username|#uid]<\/p>\n<p>       sudo -l[l] [-AknS] [-g group name|#gid] [-p prompt] [-U user name] [-u user name|#uid] [command]<\/p>\n<p>       sudo [-AbEHnPS] [-C fd] [-g group name|#gid] [-p prompt] [-u user name|#uid] [VAR=value] [-i | -s] [command]<\/p>\n<p>       sudoedit [-AnS] [-C fd] [-g group name|#gid] [-p prompt] [-u user name|#uid] file ...<br \/>\n<\/code><\/p>\n<p>&#8230; so that, logged in as &#8216;pgAgent&#8217; for instance &#8230; you can then type, at the command line &#8230;<br \/>\n<code><br \/>\nsudo -u jenkins -i<br \/>\n<\/code><br \/>\n&#8230; and if <a target=_blank title='Secure Shell information from Wikipedia ... thanks ' href='https:\/\/en.wikipedia.org\/wiki\/Secure_Shell'>ssh<\/a> access restrictions come into play, sometimes a usage as below, to switch login sessions to a session for the user &#8216;jenkins&#8217; &#8230;<br \/>\n<code><br \/>\nsu -s \/bin\/ksh jenkins<br \/>\n<\/code><br \/>\n&#8230; can be useful\n<\/ol>\n<p>The other crucial command line <i>linker<\/i> to users and groups information is the command line &#8230;<\/p>\n<p><code><br \/>\nls -la .\/<br \/>\n<\/code><\/p>\n<p> &#8230; that reports on owner (user) and group and file permissions for files in the current directory, as per &#8230;<\/p>\n<p><code><br \/>\nNAME<br \/>\n     ls -- list directory contents<\/p>\n<p>SYNOPSIS<br \/>\n     ls [-ABCFGHLOPRSTUW@abcdefghiklmnopqrstuwx1] [file ...]<br \/>\n<\/code><\/p>\n<p>We&#8217;ll leave you with <i>man man<\/i> though we really think unix should have thought <i>person person<\/i> &#8230; <font size=1>chortle, chortle<\/font> &#8230;<\/p>\n<p><code><br \/>\nNAME<br \/>\n       man - format and display the on-line manual pages<\/p>\n<p>SYNOPSIS<br \/>\n       man  [-acdfFhkKtwW]  [--path]  [-m system] [-p string] [-C config_file] [-M pathlist] [-P pager] [-B browser] [-H html-<br \/>\n       pager] [-S section_list] [section] name ...<br \/>\n<\/code><\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d22239' onclick='var dv=document.getElementById(\"d22239\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/ownership\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d22239' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Underpinning a Mac OS X MacBook Pro laptop&#8217;s workings is a Linux or Unix-like BSD operating system. This operating system, like a lot of others, uses files that have permissions and ownership. If you have file permissions they are for &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/mac-os-x-users-and-groups-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,29,37],"tags":[53,1875,204,205,206,234,336,418,422,450,1892,707,723,725,734,765,1890,1889,1190,1920,1219,1319,1339,1891],"class_list":["post-22239","post","type-post","status-publish","format-standard","hentry","category-elearning","category-operating-system","category-tutorials","tag-access","tag-bsd","tag-chgrp","tag-chmod","tag-chown","tag-command-line","tag-directory","tag-file","tag-file-permissions","tag-folder","tag-group","tag-linux","tag-mac","tag-mac-os-x","tag-macbook-pro","tag-membership","tag-owner","tag-ownership","tag-ssh","tag-su","tag-sudo","tag-tutorial","tag-unix","tag-user"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/22239"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=22239"}],"version-history":[{"count":11,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/22239\/revisions"}],"predecessor-version":[{"id":22912,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/22239\/revisions\/22912"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=22239"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=22239"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=22239"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}