can't open file for editing


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers can't open file for editing
# 1  
Old 08-23-2008
can't open file for editing

I've created a user and would like to an an alias to the .bashrc file, however when I use vi and write to the file the following is displayed:

".bashrc" E212: Can't open file for writing. Hit ENTER or type command to continue.

Entry within /etc/passwd for this user reads:
maqui:x:513:516::/home//maqui::/bin/bash
Smilie
# 2  
Old 08-23-2008
which os?

how did u create a user ? did u create your home directory manually ? do u have enough permission to write into file ?

- nilesh.
# 3  
Old 08-23-2008
Thanks for the hint Smilie I created .bashrc manually and now it seems to work. So basically:

1. I created user using adduser
2. Updated alias within the home directory i.e. /home/<user>
3. Updated permissions on the source file using chmod 755, so that the user can execute the file.

Did I "allow too much" in step 3?
# 4  
Old 08-23-2008
What do you mean by "alias"? A symbolic link to /etc/skel/.bashrc? Doesn't adduser automatically copy in a fresh .bashrc for you?

If you are editing .bashrc and it's a symbolic link, you need write permission to the target of the symbolic link. But instead, you should have a separate file owned by the user, usually a copy of /etc/skel/.bashrc

If you are editing a file owned by a different user, you need to be root, or the file's permissions need to be relaxed enough to allow you to overwrite the file (and, the way editors often work, probably write access to the directory). This is of course not really a good idea in any event.

.bashrc doesn't need execute permission, it's sourced (not executed) by bash.

Last edited by era; 08-23-2008 at 03:29 PM.. Reason: Don't need execute permission; need write access to target of symlink
 
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Convert vi editing to text editing

Dear Guru's I'm using Putty and want to edit a file. I know we generally use vi editor to do it. As I'm not good in using vi editor, I want to convert the vi into something like text pad. Is there any option in Putty to do the same ? Thanks for your response. Srini (6 Replies)
Discussion started by: thummi9090
6 Replies

2. Shell Programming and Scripting

Need help in editing a file

I have a file which has 10 million records in it. When am trying to edit the file with vi, the following error occurs: ~ ~ ~ ~ ~ ~ ~ ~ "file1" Value too large for defined data type Is there any way that I can edit this file without using vi? Any help would be really appreciated.... (8 Replies)
Discussion started by: bobby1015
8 Replies

3. Shell Programming and Scripting

editing line in text file adding number to value in file

I have a text file that has data like: Data "12345#22" Fred ID 12345 Age 45 Wilma Dino Data "123#22" Tarzan ID 123 Age 33 Jane I need to figure out a way of adding 1,000,000 to the specific lines (always same format) in the file, so it becomes: Data "1012345#22" Fred ID... (16 Replies)
Discussion started by: say170
16 Replies

4. Shell Programming and Scripting

Help with file editing while keeping file format intact

Hi, I am having a file which is fix length and comma seperated. And I want to replace values for one column. I am reading file line by line in variable $LINE and then replacing the string. Problem is after changing value and writing new file temp5.txt, formating of original file is getting... (8 Replies)
Discussion started by: Mruda
8 Replies

5. Red Hat

cannot set user id: Resource temporarily unavailable (not open file/open process related)

First post, sorry to be a bother but this one has been dogging me. I have a process user (java application server) that trips a resource limit every couple weeks and need help finding what limit we're hitting. First, this is what's running: This is the error when jobs are run or the... (0 Replies)
Discussion started by: Katahdin
0 Replies

6. Linux

file editing

I have created a file with vi -x (file name) this is encrypted file when i again open this file it ask me to enter a password before editing it.Can i remove this password but i don't want to delete a file how to do this. Thanks (0 Replies)
Discussion started by: ambavaram
0 Replies

7. Shell Programming and Scripting

Editing file

Hi, I am in a situation wherein am getting file file certailn values suppose 1u56979hhghhklklkkkjkjkjk 0 0 0 The file will have values like above only. I need to add another field of NULL value(of length 9) at the end of first column i.e. It should like this after editing:... (4 Replies)
Discussion started by: rahul303
4 Replies

8. UNIX for Advanced & Expert Users

Editing the end of the file without loading the entire file

hi! I am a newbee. I would really appreciate if you can answer the following question: I have a huge data file, 214MB with several coloumns. I need to delete the very last line of the file. Everything I know takes a lot of time to do it ( because I have to open the file in an editor or run a... (3 Replies)
Discussion started by: Garuda
3 Replies
Login or Register to Ask a Question