I have two directories say X and Y.
I am in directory X and want to know the "client root" of the client which is specified by .p4config file in one of the parent directories of directory Y.
I don't know the name of the client also.
How do I know the client root? I tried with p4 -d Y info but no luck.
Related
I have the following perforce client perforce.myClient that contains different directories. When I open a file for edit using /perforce.myClient/p4 edit someFile
it fails with the following message /perforce.myClient/someFile is not under clients root '/my/other/perforce/client'
I did the following to ensure that perforce is picking up the right client
setenv P4CLIENT perforce.myClient
checked to see if the root points to the correct location using p4 client perforce.myClient
How else can I enforce the client?
P4CONFIG files are hugely useful for this. Do this:
p4 set P4CONFIG=.p4config
echo P4CLIENT=perforce.myClient>/perforce.myClient/.p4config
echo P4CLIENT=my.other.perforce.client>/my/other/perforce/client/.p4config
Now your P4CLIENT will change automatically based on your working directory.
http://www.perforce.com/perforce/doc.current/manuals/cmdref/P4CONFIG.html
You should be able to use the global options in your command like
p4 -c myclient edit -c mychangelist //...
Global options appear before the command name.
I'm taking over a Linux Ubuntu machine from a previous employee whose recently left. I've created an account for myself on the machine.
I want to preserve their home directory, but change ownership of any system files and directories outside of their home directory to myself.
Basically if User X is the previous user who has left I want to change any system files and directories belonging to User X outside of their home directory to myself now (e.g. stuff within /var/www, /usr/local etc. The only thing left that should have ownership to User X would be their home directory and anything within it. Later I can then backup anything within their home directory and then delete when ready.
Is there a known tool for such a job? Or am I looking for long piped command from the Terminal? E.g. from root, search entire file system for all files &dirs belonging to user X | chown to me? What would a long command like that look like?
Thanks.
find / -user X \( -name ~X -prune -o -exec chown Y:Y {} \; \)
I wrote a python script and put it into /bin. What I need is to let user could only run this script when they log in my computer by ssh.
I set an alias to generate user information as below:
alias USER_GEN='useradd -d /dev/null -s /bin/my_shell.py'
Problems:
Every time when I use USER_GEN to create an user account, the bash warns me "The home directory is exists."
After creating user account and log into my computer the bash warns me """No directory /dev/null!!Logging in with Home = "/" .""""
Question:
How to let those warning disappear?
/dev/null is not a directory. It is a (special) file. A home directory is expected to be a directory. If it is not, the login process will use the root directory as a home directory, as indicated.
If you want the user to not be able to create files in their home directory, don't give them write permissions on the directory. But make sure that it is a directory.
Is there any way to a map a symbolic link directory to different directories based on the user id in Linux. For instance if a user X executes cd /var/www/html/ then his/her directory gets changed to /var/www/webX/, while for the user Y it would be /var/www/webY. The purpose of doing this is to make the web document directories transparent for different apache users.
Thanks
One line answer: No. The linux filesystem does not support conditional symlink evaluation of the type you are envisioning.
Alternatives:
=> (Programmatically) Create symlinks in each user's home directory which point to the required location in /var/www/. For example, in user X's home directory:
ln -s /var/www/htmlX htmldir
In user Y's home directory:
ln -s /var/www/htmlY htmldir
So that each user can just go cd htmldir and get to the appropriate location.
=> Use the per-user directory feature to assign ~user/public_html or more generically, ~user/<some-name-consistent-across-users> as the HTML dir for user.
I have a directory on a files on 2 different partitions, as i need these hardlinked rather than symlinked when they are rsync'd to my client server, does the -L option use the target name or the host name of the file ..
i.e. my symlink looks like:
file_a.txt_ahahagj -> /usr/local/etc/file_a.txt
does it use:
file_a.txt_ahahagj or file_a.txt
i need it to use file_a.txt_ahahagj if anyone knows how to do this it would be great
Rsync -L does work for this scenario it will use the target name when syncing.