LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Can't change permission (https://www.linuxquestions.org/questions/linux-newbie-8/cant-change-permission-420531/)

karpa 03-01-2006 02:54 AM

Can't change permission
 
Hi, I am running Ubantu, and just have inserted a new removable device (Usb memory stick).
I have logged in a root and still can't change permission. The current permission is 700 and want to change it to 755. When I cick on the properties of the removable volume and select the permission tab, and try to check mark the permissions they get disable about half a sec after I enable them.

titopoquito 03-01-2006 03:35 AM

Your memory stick is probably formatted with FAT32, i. e. "vfat" in terms of the mount command. You cannot change permissions on a vfat partition if it is mounted, instead you have to give it the option "umask=xxxx" to the mount command. Take a look for example here on linuxquestions what it means or in the man pages. It is contrary to the way permissions normally work. An umask of "000" means no prohibitions, that means read, write and executable rights for anyone. Maybe you have also to change the gid and uid options to assign the device to a certain group or user.

That having said, I don't know how to change this automount behaviour in Ubuntu. But maybe a search with usb vfat automount umask etc. will get you further how to solve your problem specifically.

nx5000 03-01-2006 03:36 AM

Maybe because your usb stick is formatted with a FAT filesystem? And vfat does not handle permissions :in Windows, you can't change permissions on fat also , its only on NTFS

karpa 03-01-2006 05:21 AM

Yes you are right, its formatted with FAT32.
How do I format it with Linux?

Thanks in advance

jomen 03-01-2006 06:02 AM

I would not recommend putting another filesystem on it - except if you want to use the USB-stick for linux only.
If you format it with ext2 for example - windows will not be able to read the stick anymore - unless you install the tools to do it on every machine you might come across...
And: you put a file-system (maybe one rather specific to linux) on a disk-partition - you don't format it with linux...
It has been pointed out that there is no way to set permissions on vfat. But you can mount it to appear as it having permissions with the umask option.

titopoquito 03-01-2006 06:19 AM

If you really want to format it with any other file system, you first have to know which device is the right one (for example by attaching the memory stick and get the device name from /var/log/messages, might be /dev/sda1 or any other). The device has to me unmounted for the next step. Then an mkfs.xxxx /dev/sda1 should format your device -- be sure to give the right device name and decide which file system you want. There are several mkfs.* like mkfs.reiserfs mkfs.ext2 mkfs.xfs.

jomen 03-01-2006 06:47 AM

...and if you use ext2 - pay attention to the -m switch to mkfs (reserved-blocks-percentage).
If you go with the default 5% of it will be usable to noone else than root - which doesn't make much sense on a usb-stick

karpa 03-01-2006 09:50 AM

Thanks I managed to format, see below:
kenneth@ubuntu:~$ su
Password:
root@ubuntu:/home/kenneth# mkfs.ext2 /dev/sdb
mke2fs 1.38 (30-Jun-2005)
/dev/sdb is entire device, not just one partition!
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
32000 inodes, 128000 blocks
6400 blocks (5.00%) reserved for the super user
First data block=1
16 block groups
8192 blocks per group, 8192 fragments per group
2000 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729

Writing inode tables: done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 24 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

I have one problem left, I logged in as root, changed permission to 755 and transfered some files in external memory stick, but when I try to run an executable file directly from Memory USB it does not run, I even tried ps -A to see if the process is running. Same file run ok directly from desktop

titopoquito 03-01-2006 10:03 AM

Quote:

Originally Posted by karpa
6400 blocks (5.00%) reserved for the super user

I have one problem left, I logged in as root, changed permission to 755 and transfered some files in external memory stick, but when I try to run an executable file directly from Memory USB it does not run, I even tried ps -A to see if the process is running. Same file run ok directly from desktop

First, you have some space reserved for root like jomen wrote that will be not accessible for normal users.
Second, look in the mount options -- maybe your memory stick is mounted with the "noexec" option which will prevent you from executing files from there.

PS: Just noticed that you gave sdb as argument and the program complained about this. I don't know if this is part of the problem, guess not. Usually you would give a specific partition I think like sdb1.

jomen 03-01-2006 02:45 PM

I think you did a few things wrong:
First the -m switch was missing, so now you can only access 95% of the memory if you are not root - but if that is what you desired - ok.
Second - you made a filesystem to the entire device instead of making it to the partition (the first and only one on the stick)
I would be surprised if this actually works...
Quote:

root@ubuntu:/home/kenneth# mkfs.ext2 /dev/sdb
mke2fs 1.38 (30-Jun-2005)
/dev/sdb is entire device, not just one partition!
There was a partition on that device - which had the vfat filesystem on it.
This one you change to ext2 - not the entire device!
It is the same as your harddisk - you dont make a filesystem to /dev/hda - you make one to /dev/hda1 or /dev/hda2 and so on.
the sequence would be:
(while the stick is not mounted)
fdisk /dev/hdb -> make one partition there
(or use: cfdisk /dev/hdb for an easier to use interface)
mkfs.ext2 -m 0 /dev/hdb1

karpa 03-02-2006 05:48 AM

when you partition, which do you use:

1 Bootable? yes or no
2 FS TYPE (which i need to run exe directly from there)
3 Part Type? Primary or Logical

Thanks

jomen 03-02-2006 05:59 AM

1. need not be
2. running exe - I assume you want to use it with windows - so chose a filesystem windows can handle - and the partition type accordingly: this would be
0C -> for W95 FAT32 (LBA) or
0B -> for W95 FAT32
3. primary

karpa 03-02-2006 06:11 AM

When I set as primary, i get this error

WroNo primary partitions are marked bootable. DOS MBR cannot boot this.e.
Toggle bootable flag of the current partition

I set it as bootable, and i managed, I have full permissions 755 and still can't run exectable files.

The file properties are that i am trying to run are:
TYPE: executable
LOCATION: media/USB/kenneth
MIME TYPE: application/x-executable


Nore: I only need the USB memory stick for the Linux PC's, so I can run the same exe file at work on the Linux PC

jomen 03-02-2006 06:26 AM

Do you want to boot from it? - if yes set a/one partition bootable, else ignore - or just try and see...

karpa 03-02-2006 06:55 AM

No i don't want to boot from it, all i want to do is run an exe file, which will create some text files in the usb memory itself

Note: When I put the all the contents of the External momory stick on desktop, all works fine but I would like to run it directly from USB so I carry the Memory stick from one Linux PC to another.

Thanks for you help


All times are GMT -5. The time now is 03:57 AM.