Thread: replace a file in user level

  1. #1
    Registered User
    Join Date
    Dec 2006
    Posts
    136

    replace a file in user level

    hi all
    how to replace a file in user level..
    i tried this
    Code:
    cp -r /usr/lib/munna.txt /usr/lib/
    saying the error permission denied..
    is there any way..

    please help me to replace a file in user level (not from root)

    thank you in advance

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    There is a reason you can't do that! That's the whole point of file-permissions. You need to be root to write files into /usr/lib.

    --
    Mats

  3. #3
    Registered User
    Join Date
    Dec 2006
    Posts
    136
    Quote Originally Posted by matsp View Post
    There is a reason you can't do that! That's the whole point of file-permissions. You need to be root to write files into /usr/lib.

    --
    Mats

    for my application(exe)
    i instaaled the rpm in root level.
    then i ran the exe from user level..
    while running the exe this replace could be take place..

    please show me the way..

    thank you in advance

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    If you are NOT root, then you can't write to /usr/lib, that's it! This is called "file protection", and most OS's have it. It's there so that normal user's can't mess the system up.

    --
    Mats

  5. #5
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    Quote Originally Posted by munna_dude View Post
    then i ran the exe from user level..
    while running the exe this replace could be take place..
    So that executable propably has the suid bit set and runs with the rights of root.
    Kurt

  6. #6
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Location
    Cambridge, UK
    Posts
    1,732
    try
    Code:
    sudo cp -r /usr/lib/munna.txt /usr/lib/
    You should be know the root password to execute this command. Which distribution are u using?

    ssharish2005

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-21-2008, 11:19 PM
  2. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  3. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. archive format
    By Nor in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 08-05-2003, 07:01 PM