Find the answer to your Linux question:
Results 1 to 7 of 7
I want to be able to create a php webpage that will show the logged in users files and how full their home directory is (roaming profiles). The php side ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2011
    Posts
    9

    How to find the username of a user who has logged in (roaming profile)


    I want to be able to create a php webpage that will show the logged in users files and how full their home directory is (roaming profiles).

    The php side isn't a problem....the problem is how do i determine the username of the user who is logged into Linux not the webpage itself?

    What i want is when the user opens this page, it knows who they are already.

    I have seen this done on an intranet at work (don't know what OS it is running on tho) where I login to the network, view the page and it says my name.

  2. #2
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,758
    "w" command will give you list of logged in users. Just quite curious , If its not confidential , what your application will do?
    First they ignore you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -----
    FOSS India Award winning ext3fs Undelete tool www.giis.co.in. Online Linux Terminal http://www.webminal.org

  3. #3
    Just Joined!
    Join Date
    Mar 2011
    Posts
    9
    All i want is as intranet page whci hwill have the usual crap on there but also a list of files the user has on there home drive plus how much space they have left.

    Is there a file that gets updated with a list of logged on users that I can read?

  4. #4
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,758
    Yes,there is utmp file check
    man utmp
    But its hard to parse - better use "w" command abd parse its output.
    First they ignore you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -----
    FOSS India Award winning ext3fs Undelete tool www.giis.co.in. Online Linux Terminal http://www.webminal.org

  5. #5
    Just Joined!
    Join Date
    Mar 2011
    Posts
    9
    Quote Originally Posted by Lakshmipathi View Post
    Yes,there is utmp file check

    But its hard to parse - better use "w" command abd parse its output.
    Hav eyou any idea how i would call that command using php?

  6. #6
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,758
    Are you running php application on the same machine.Where users logs in?
    If so,php has system() function where you can provide/invoke shell commands.
    PHP: system - Manual

    You can redirect the output to some file and then parse that file. Or you can store the output of "w" to php variable and parse it.
    First they ignore you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -----
    FOSS India Award winning ext3fs Undelete tool www.giis.co.in. Online Linux Terminal http://www.webminal.org

  7. #7
    Just Joined!
    Join Date
    Mar 2011
    Posts
    9
    Thanks for the reply....i think it is what i need.

    I just saw something about security risks and that a user could gain access to the computer. Would anyone be able to do this if the web page is only hosted locally using php and apache and my users who i want to allow the view the page would only be users who VPN onto the machine?

    I will only have about 5 users that i will create so would VPN be secure enough or is there alternative method which my users could do (most of them are not tech savvy but will know how to do it when i show them).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •