• No results found

Solution for Practice 11-4: Troubleshooting Directory Access Issues

Task 1: Resolving the Access to Directory Issue

Scenario

You plan to log in as John Holt and perform some tasks. The problem is that after logging in to John Holt’s account, when you attempt to cd into his home directory, you get an error. You must troubleshoot and correct this problem.

Scenario Setup:

On Sol11-Server1, from the /opt/ora/scripts directory, execute lab11_bug3: # ./lab11_bug3

Hints:

• Check the permissions of the /export directory. • Check the permissions of the /export/test directory. • Check the permissions of the /export/test/bug directory.

1. Verify that the Sol11-Server1 virtual machine is running. If the virtual machine is not running, start it now.

2. Log in to the Sol11-Server1 virtual machine as the oracle user. Use oracle1 as the password. Assume administrator privileges.

oracle@s11-server1:~$ su - Password:

Oracle Corporation SunOS 5.11 11.0 November 2011 root@s11-server1:~#

3. Log in to John Holt’s account by using the su command. Attempt to cd into the /export/test/bug directory.

root@s11-server1:~# su - jholt

Oracle Corporation SunOS 5.11 11.0 November 2011 jholt@s11-server1:~$ cd /export/test/bug

-bash: cd: /export/test/bug: Permission denied Investigate the cause in the subsequent steps.

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 11: Performing Basic System Monitoring and Troubleshooting

4. Exit to the superuser account and check the permissions on the intervening directories (that is, on /export/test and /export/test/bug).

jholt@s11-server1:~$ exit logout

root@s11-server1:~# ls -ld /export/test

drwxr--r-- 9 root root 9 Dec 5 14:32 /export/test root@s11-server1:~# ls -ld /export/test/bug

drwxr--r-- 17 root root 33 Dec 5 18:02 /export/test/bug

It looks like the /export/test and /export/test/bug directories were created by the root user.

What permission does John Holt need to be able to cd into these two directories? He

needs the x (execute) permission.

Do they have the required permission for the non-root users to cd into these directories?

No

5. Using the chmod command, change permissions on the directory and the file. Verify the results.

root@s11-server1:~# chmod 755 /export/test root@s11-server1:~# chmod 755 /export/test/bug root@s11-server1:~# ls -ld /export/test

drwxr-xr-x 3 root root 3 Dec 5 14:32 /export/test root@s11-server1:~# ls -ld /export/test/bug

drwxr-xr-x 2 root root 2 Dec 5 09:12 /export/test/bug Are the required permissions in place? Yes

6. Log in to John Holt’s account and attempt to access the directories. root@s11-server1:~# su - jholt

Oracle Corporation SunOS 5.11 11.0 November 2011 jholt@s11-server1:~$ cd /export/test/bug

jholt@s11-server1:/export/test/bug~$

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 11: Performing Basic System Monitoring and Troubleshooting

Task 2: Resolving the Default Shell Issue

Scenario

You notice that a user called sstudent has been created with the default shell of bourne. The problem is that when you log in as sstudent and attempt to verify the default shell, it turns out to be a different shell. You must troubleshoot and take corrective action if needed.

Hints:

• Check the default shell assigned to the user sstudent. • View the man pages for the default bourne shell. • Determine the relationship between both shells.

1. Verify that the Sol11-Server1 virtual machine is running. If the virtual machine is not running, start it now.

2. Log in to the Sol11-Server1 virtual machine as the oracle user. Use oracle1 as the password. Assume administrator privileges.

oracle@s11-server1:~$ su - Password:

Oracle Corporation SunOS 5.11 11.0 November 2011 root@s11-server1:~#

3. Use the cat command to display the /etc/passwd file. Determine the default shell configuration for the sstudent user.

root@s11-server1:~# cat /etc/passwd ... ... ... jholt:x:60005:10:john holt:/home/jholt:/bin/bash jmoose:x:60006:10:jerry moose:/home/jmoose:/bin/bash panna:x:60007:10:polly anna:/home/panna:/bin/bash sstudent:x:60008:10:super student:/home/sstudent:/bin/sh

What is the default shell for the sstudent account? sh (Bourne shell)

4. Log in to the sstudent account and issue the ps command to determine the default shell. root@s11-server1:~# su - sstudent

Oracle Corporation SunOS 5.11 11.0 November 2011 sstudent@s11-server1:~$ ps

PID TTY TIME CMD 3255 pts/1 0:00 ksh93 3261 pts/1 0:00 ps The default shell is displayed as ksh93. Why? Find out in the next step.

Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 11: Performing Basic System Monitoring and Troubleshooting

5. Using the man command, display the man pages for the bourne shell (sh) and the ksh93 shell.

sstudent@s11-server1:~$ man sh

User Commands sh(1) NAME

sh, jsh - standard and job control shell and command interpreter

SYNOPSIS

/usr/bin/sh [acefhiknprstuvx] [argument]... /usr/xpg4/bin/sh [+ abCefhikmnoprstuvx] [+ o option]... [-c string] [arg]...

/usr/bin/jsh [acefhiknprstuvx] [argument]... DESCRIPTION

The /usr/bin/sh utility is a command programming language that executes command read from a terminal or a file.

... ... ... sstudent@s11-server1:/home/sstudent$ man ksh93 User Commands ksh93(1) NAME

ksh93, rksh93 - Korn Shell, a standard and restricted com- mand and programming language

SYNOPSIS

ksh93 [+abcefhikmnoprstuvxBCD] [-R file] [ +o option] ... [-] [arg ...]

rksh93 [+abcefhikmnoprstuvxBCD] [-R file] [+o option] ... [-] [arg ...]

DESCRIPTION

ksh93 is a command and programming language that executes commands read from a terminal or a file. rksh93 is a res-