LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   What drive am I on? (https://www.linuxquestions.org/questions/linux-newbie-8/what-drive-am-i-on-449112/)

noobtastic 05-27-2006 02:31 PM

What drive am I on?
 
Hullo penguins,

Its been a few years since I touched linux, now I'm back on it with RHEL 4. I have two questions if you please!

1) I am logged in as root. I have four hard drives. But how do I determine which drive all the main files are on?

Code:

root@host [/home]# cd /
root@host [/]# ls
./            .autofsck      boot/  etc/      hdd3/    lib/        misc/  portsentry-1.1-5.i386.rpm  root/    selinux/  tmp/
../          auto-whitelist  dev/    .forward  home/    lost+found/  mnt/  proc/                      sbin/    srv/      usr/
aquota.user*  bin/            disk1/  hdd2/    initrd/  media/      opt/  quota.user*                scripts/  sys/      var/
root@host [/]# df
Filesystem          1K-blocks      Used Available Use% Mounted on
/dev/sda1            478655540  2888788 451452380  1% /
none                  1036932        0  1036932  0% /dev/shm
/dev/sdb1            480719056    106572 456193284  1% /disk1
/dev/sdc1            480719056    106572 456193284  1% /hdd2
/dev/sdd1            480719056    106572 456193284  1% /hdd3
/usr/tmpDSK            495844    10564    459680  3% /tmp
/tmp                    495844    10564    459680  3% /var/tmp
root@host [/]#


And secondly. I have created a user. And this user has absolutely no permission to do anything. Now I think this may have something to do with assigning the user to a group that has +x permission on each service I am trying to run?

I mean for example, even SU does not work.
Code:

vsftpd@host [/]# su root
bash: /bin/su: Permission denied

Please help!

pansarevaibhav 05-27-2006 02:46 PM

hi,
put the following command
df -h
it will show u which partition is on which hdd
if it is /dev/hda then its primary master and likewise
about adding a user check the user entry in /etc/passwd file what is uid and gid
for time being to make it root user u can change uid of user to 0 so it will have all access .
to add in roots group use
adduser -g username group
thanks

Brian1 05-27-2006 02:53 PM

Look at your /etc/fstab file to see the drive and partition location of the ones linux is using.

Also just do ' su ' or ' su - '. su is root with the previous users enviroment variables. su - is root using root's enviroment variables.

Brian1

dannystaple 05-27-2006 02:56 PM

Quote:

Originally Posted by noobtastic
1) I am logged in as root. I have four hard drives. But how do I determine which drive all the main files are on?

Well I would probably say /dev/sda1 as that is mounted as /, and the "main files", which I would determine to be apps, and configuration, are most likely going to be in /usr and /etc, which since they are not looking to be anything else mounted are probably there.

However, there is a potential that one of those is symlinked to /disk1, /hdd2 or /hdd3, but I would imagine that many apps would not play ball with a symbolic linked /usr or /etc so it is probably a very safe bet that they are on /dev/sda1. This could be quickly asserted with an "ls -l".

You do know you can use "df -h" to get a human friendly version in 2Dp units like Kb, Mb and Gb.

Quote:

And secondly. I have created a user. And this user has absolutely no permission to do anything. Now I think this may have something to do with assigning the user to a group that has +x permission on each service I am trying to run?
Actually su is probably not the best test for execute priveliges as a "normal" user may not be allowed to run su. A more simple app to test would be "env".

What groups are the user in? How did you create the user?

Danny

noobtastic 05-27-2006 03:15 PM

Thank you for all your replies!

Brian the contents of /etc/fstab reads:

Code:

# This file is edited by fstab-sync - see 'man fstab-sync' for details
LABEL=/                /                      ext3    defaults,usrquota        1 1
none                    /dev/pts                devpts  gid=5,mode=620  0 0
none                    /dev/shm                tmpfs  defaults        0 0
LABEL=/disk1            /disk1                  ext3    defaults,usrquota        1 2
LABEL=/hdd2            /hdd2                  ext3    defaults,usrquota        1 2
LABEL=/hdd3            /hdd3                  ext3    defaults,usrquota        1 2
none                    /proc                  proc    defaults        0 0
none                    /sys                    sysfs  defaults        0 0
LABEL=SWAP-sda2        swap                    swap    pri=0,defaults        0 0

pansarevaibhav I typed df -h and this is the output:

Code:

root@host [/]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1            457G  2.8G  431G  1% /
none                1013M    0 1013M  0% /dev/shm
/dev/sdb1            459G  105M  436G  1% /disk1
/dev/sdc1            459G  105M  436G  1% /hdd2
/dev/sdd1            459G  105M  436G  1% /hdd3
/usr/tmpDSK          485M  11M  449M  3% /tmp
/tmp                  485M  11M  449M  3% /var/tmp
root@host [/]#

So... I am presuming that /dev/sda1 is the drive I am on, as the others seem to have no sizeable data differential in comparison to sda1.

Q1) What is the 'none' drive? Is this normal?

As suggested I also look in to /etc/passwd and this is what it says for VSFTPD:
Code:

vsftpd:x:32003:32003::/home/vsftpd:/bin/bash
Q2) I do not wish to give the user root privelege. I wish to 'If possbile!' assign which commands the user may execute. Or, as to which folders the user may execute/write etc within. Is there a simple command for this?

Thanks to all who took the time to reply, I appreciate it.

Brian1 05-27-2006 03:22 PM

Forgot the redhat scheme of /etc/fstab. You need to look at /etc/mtab to see what /dev the LABEL equeals to in /etc/fstab.

Misread the section on su in post.
If you wish to allow a user a few root commands then you can either setup /etc/sudoers file using the visudo tool to edit.

Brian1

jschiwal 05-27-2006 03:32 PM

The vfstpd user is a system user and not a regular user. Create a real regular user account to use.

The "none" in /etc/fstab is normal for "shm" and "proc" and other pseudo filesystems.

noobtastic 05-27-2006 03:37 PM

Quote:

The vfstpd user is a system user and not a regular user. Create a real regular user account to use.
Thanks for your reply. Im not sure the difference between creating a system and regular user. I used this:

Code:

adduser fsftpd
passwd fsftpd

etc. can you detail what the difference is in command terms? Sorry!

sdexp 05-27-2006 08:45 PM

System users don't have home directories like regular users, and they have awkward names.

You should make sure even the system users are placed in the group of regular users so, so the system users can use commands such as su.

dannystaple 05-28-2006 04:28 AM

Quote:

Originally Posted by noobtastic
Q2) I do not wish to give the user root privelege. I wish to 'If possbile!' assign which commands the user may execute. Or, as to which folders the user may execute/write etc within. Is there a simple command for this?

If you want to selectively control who can run what, your best bet is to use groups.
This work swell if you have a whole bunch of commands you only want some users, but not all to run. First, group up the commands by who needs to use them, for example if commands a,b and c should be usable by some users, and commands d, e and f by some others, you have two groups there. Then create groups for these on your system (with a suitable name like "accessabc").

You then change the group ownership of the commands in question (you can find their actual dir location with "which" followed by the command name) to the new group, and unset the everybody execute flag:

(Example for the command su)
Code:

$ which su
/usr/sbin/su
$ chgrp sugroup /usr/sbin/su
$ chmod o-x /usr/bin/su

Then you ensure that the item has got the group execute flag:
Code:

$ chmod g+x /usr/bin/su
And then add the users you want to run it to the group (as a secondary group), which can be done by simply adding the user to the list of groups following the last colon in the /etc/group file.
Users not in that group will then not be able to execute the command. However, if the command is a perl, or shell script, they may be able to circumvent the execute protection by running it from the interpreter. A way to prevent that is to unset the global read flag (o-r), and ensure that the group read flag is set (g+r) so that only users in the group can even read the file the command is stored in.

Danny


All times are GMT -5. The time now is 03:33 PM.