The UNIX and Linux Forums
Forum Home
Linux and Unix Man Pages
Search Forums
Search Community Posts
Today's Posts
Quick Links
Man Pages
RedHat Commands
OpenSolaris Commands
Linux Commands
SunOS Commands
FreeBSD Commands
All UNIX Man Pages
All Linux Man Pages
Full Man Repository
Login or Register to Ask a Question and Join Our Community
Search Forums
Show Threads .
Show Posts
Tag Search
Advanced Search
Quick Links
Contact Us
Forum Rules
Today's Posts
FAQ
Pictures & Albums
All Albums
Miscellaneous
What is My IP
Whois
Mark Forums Read
Shell Programming and Scripting
need one help
Tags
shell scripts
Login to Discuss or Reply to this Discussion in Our Community
Thread Tools
Search this Thread
Top Forums
Shell Programming and Scripting
need one help
#
1
03-27-2008
namishtiwari
Registered User
390,
0
Join Date: Aug 2007
Last Activity: 2 October 2012, 1:31 PM EDT
Location: Bangalore
Posts: 390
Thanks Given: 0
Thanked 0 Times in 0 Posts
need one help
Hii,
I have a file that is read only file.i want to change the permission of the file remaining inside the file.How can i do that.
i used this
:! chmod 755 %
but it is not doing the desired thing.
Help me out in this.
namishtiwari
View Public Profile for namishtiwari
Find all posts by namishtiwari
#
2
03-27-2008
era
Registered User
3,653,
12
Join Date: Mar 2008
Last Activity: 28 March 2011, 6:41 AM EDT
Location: /there/is/only/bin/sh
Posts: 3,653
Thanks Given: 0
Thanked 12 Times in 10 Posts
What does "remaining inside the file" mean?
What do :! and % signify above? If they are features of your shell then please mention which shell.
chmod 755 file
will turn on read, write, and execute for the owner, and read and execute for others.
era
View Public Profile for era
Find all posts by era
#
3
03-27-2008
namishtiwari
Registered User
390,
0
Join Date: Aug 2007
Last Activity: 2 October 2012, 1:31 PM EDT
Location: Bangalore
Posts: 390
Thanks Given: 0
Thanked 0 Times in 0 Posts
I opened a file with vi say
vi filename
this file is read only that is i can not do any modifications in this.
i want to be inside vi and change the permission of the file.
is this helpfull.
Thanks.
namishtiwari
View Public Profile for namishtiwari
Find all posts by namishtiwari
#
4
03-27-2008
Shivdatta
Registered User
104,
1
Join Date: Mar 2006
Last Activity: 7 January 2015, 3:22 AM EST
Posts: 104
Thanks Given: 0
Thanked 1 Time in 1 Post
How can you edit a file that has read only priv ??
If you have the write priv then you can include the foll to change the
other privs
chmod 777 $0
and run the script again....note the permissions change thereafter...
Shivdatta
View Public Profile for Shivdatta
Find all posts by Shivdatta
#
5
03-27-2008
era
Registered User
3,653,
12
Join Date: Mar 2008
Last Activity: 28 March 2011, 6:41 AM EDT
Location: /there/is/only/bin/sh
Posts: 3,653
Thanks Given: 0
Thanked 12 Times in 10 Posts
Please don't advise
chmod 777
as it has rather undesirable security effects.
As a workaround you can write the file to /tmp from within your editor and then replace the file from the prompt after you have changed the permissions.
era
View Public Profile for era
Find all posts by era
#
6
03-27-2008
Shivdatta
Registered User
104,
1
Join Date: Mar 2006
Last Activity: 7 January 2015, 3:22 AM EST
Posts: 104
Thanks Given: 0
Thanked 1 Time in 1 Post
Open the oldfile in the vi editor in Esc mode
use the following
:w newfilename
It will create a copy of the oldfile having write priv.....
Hpe this helps
Shivdatta
View Public Profile for Shivdatta
Find all posts by Shivdatta
#
7
03-28-2008
aajan
Registered User
80,
0
Join Date: Jun 2007
Last Activity: 25 November 2008, 12:42 AM EST
Posts: 80
Thanks Given: 0
Thanked 0 Times in 0 Posts
HI,
It works Perfectly for me!!!!!!!!!!!!!!!!!
I created a file called "test" and then i opened it using the command
"vi test"
and then u should save the file once and only then u can modify it by opening the file and giving the command :!chmod 777 %..
Regards,
aajan
aajan
View Public Profile for aajan
Find all posts by aajan
Login or Register to Ask a Question
Previous Thread
|
Next Thread
Login or Register to Ask a Question
Member Badges and Information Modal
×