- Opening current directory from a terminal onto a file browser?
- 4 Answers 4
- Вики IT-KB
- Утилита ldapsearch (клиент OpenLDAP) и проверка подключения к контроллеру домена Active Directory
- Проверка подключения по протоколу LDAP (TCP 389)
- Проверка подключения по протоколу LDAPS (TCP 636)
- Проверка подключения по протоколу LDAP с защитой StartTLS (TCP 389)
- Обсуждение
- Apple Open Directory Linux Client Setup (Debian GNU/Linux and Derivatives)
- Password Server (Kerberos)
- Getting Usernames & Group Info from Open Directory
- Automatic Home Directory Creation:
- Conclusion
- How to open a directory/folder and a URL through Terminal
- 7 Answers 7
- How to open and close directories in the Linux terminal
- Close a folder
- Use the Linux terminal to see what files are on your computer
- 20 Linux commands every sysadmin should know
- 3 Linux terminals you need to try
- 1 Comment
- Related Content
- About This Site
Opening current directory from a terminal onto a file browser?
My current directory is buried deep in multiple subfolder layers from my home directory. If I want to open this directory in a gui-based file browser, I have to double click folder after folder to reach it. This is very time consuming. On the other hand, with very few key strokes and several times hitting the tab button, it is very easily reachable via a terminal. I want to know if there is a way to open the current directory in a terminal onto a a file browser. What is the command to do this? For reference, I have an ubuntu system, but I’d like to know what the commands are across the various distributions of linux.
That really depends on what operating system and GUI environment you’re using. For example, off the top of my head, on an OS X system, open /path/to/some/directory will open a Finder window for that directory. On Windows, it’s some invocation of explorer.exe In KDE or GNOME or LXDE, there are probably incantations unique to each environment that can be used. In short, more detail is needed for your specific use-case.
That would depend on the specific «file explorer» or windowing system you are using. As a reference, on Mac OS X, open . will open a Finder window on the current directory. A similar command may exist on your system.
4 Answers 4
xdg-open is part of the xdg-utils package, which is commonly installed by default in many distributions (including Ubuntu). It is designed to work for multiple desktop environments, calling the default handler for the file type in your desktop environment.
You can pass a directory, file, or URL, and it will open the proper program for that parameter. For example, on my KDE system:
- xdg-open . opens the current directory in the Dolphin file manager
- xdg-open foo.txt opens foo.txt in emacsclient, which I’ve configured to be the default handler for .txt files
- xdg-open http://www.google.com/ opens google.com in my default web browser
The application opens as a separate window, and you’ll get a prompt back in your terminal and can issue other commands or close your terminal without affecting your new GUI window.
I usually get a bunch of error message printed to stderr , but I just ignore them.
Edit:
Adding the arguments xdg-open . >/dev/null 2>&1 redirects the errors and the output. This call won’t block your terminal. Binding this to an alias like filemanager=’xdg-open . >/dev/null 2>&1′ can come in handy.
Вики IT-KB
Утилита ldapsearch (клиент OpenLDAP) и проверка подключения к контроллеру домена Active Directory
Проверку выполняем на примере Debian GNU/Linux 8 (Jessie). Сначала убедимся в том, что клиент OpenLDAP установлен в системе:
ii ldap-utils 2.4.40+dfsg-1+deb8u2 amd64 OpenLDAP utilities ii libldap-2.4-2:amd64 2.4.40+dfsg-1+deb8u2 amd64 OpenLDAP libraries
Исходные данные для проверки подключения клиента OpenLDAP к LDAP-каталогу на примере контроллера домена Active Directory (AD):
s-LDAP-Check-User — Имя пользователь в домене AD, от имени которого выполняется подключение (уровень прав в домене — рядовой пользователь);
«OU=Test Users,OU=KOM,DC=ad,DC=holding,DC=com» — DN-имя контейнера в AD, в котором выполняется поиск пользователя Test-User.
Проверка подключения по протоколу LDAP (TCP 389)
Используется подключение типа ldap:/. Учётные данные пользователя s-LDAP-Check-User передаются по сети в открытом виде:
$ ldapsearch -v -x \ -D "s-LDAP-Check-User@ad.holding.com" -w "PaZsw0rd" \ -b "OU=Test Users,OU=KOM,DC=ad,DC=holding,DC=com" \ -H "ldap://dc01.ad.holding.com" sAMAccountName=Test-User
Проверка подключения по протоколу LDAPS (TCP 636)
Используется подключение типа ldaps:/. LDAP-сессия шифруется с помощью SSL-сертификата, предоставляемого контроллером домена. Чтобы LDAP-клиент доверял сертификату контроллера домена, нам нужно создать файл, содержащий корневые сертификаты доменных Центров сертификации, которыми подписан сертификат контроллера домена. Назовём этот файл, например /etc/ssl/certs/cacerts.pem, и скопируем в него корневые сертификаты доменных ЦС в формате PEM и кодировке Base-64.
Изменим на время проверки конфигурационный файл клиента OpenLDAP /etc/ldap/ldap.conf, указав в переменной TLS_CACERT путь к созданному нами файлу с корневыми сертификатами доменных ЦС:
. #TLS_CACERT /etc/ssl/certs/ca-certificates.crt TLS_CACERT /etc/ssl/certs/cacerts.pem .
После этого можно попробовать выполнить поиск по протоколу LDAPS:
$ ldapsearch -v -x \ -D "s-LDAP-Check-User@ad.holding.com" -w "PaZsw0rd" \ -b "OU=Test Users,OU=KOM,DC=ad,DC=holding,DC=com" \ -H "ldaps://dc01.ad.holding.com" sAMAccountName=Test-User
Проверка подключения по протоколу LDAP с защитой StartTLS (TCP 389)
Используется подключение типа ldap:/ с дополнительными ключами, включающими TLS : -Z и -ZZ. LDAP-сессия также шифруется с помощью SSL-сертификата, предоставляемого контроллером домена. Первичное подключение к контроллеру домена AD происходит по порту 389, затем создаётся отдельный защищённый TLS-туннель, внутри которого и происходит весь LDAP-обмен между клиентом и сервером. Используется настроенный нами ранее файл корневых сертификатов доменных ЦС.
$ ldapsearch -Z -v -x \ -D "s-LDAP-Check-User@ad.holding.com" -w "PaZsw0rd" \ -b "OU=Test Users,OU=KOM,DC=ad,DC=holding,DC=com" \ -H "ldap://dc01.ad.holding.com" sAMAccountName=Test-User
Автор первичной редакции:
Алексей Максимов
Время публикации: 19.03.2017 18:04
Обсуждение
unix-linux/linux-cli-tools/openldap-ldap-client-check-connection-to-active-directory-domain-controller-with-ldapsearch.txt · Последнее изменение: 19.03.2017 19:05 — Алексей Максимов
Apple Open Directory Linux Client Setup (Debian GNU/Linux and Derivatives)
If you were once running all services on macOS Server then it may be that you are still using Open Directory. Open Directory is an LDAP/Kerberos service implementation and should work with a variety of UNIX and Linux systems. The following gives an example of enabling user login to a Linux client machine connected to Apple Open Directory. I have tested this procedure on Debian GNU/Linux 10, 11, and Ubuntu 20.04 LTS.
Password Server (Kerberos)
The simplest way to start is by setting up Kerberos only; we’ll add the user account information from LDAP latter. Enter all commands logged in as root, or precede all commands with ‘sudo’
- apt install krb5-config krb5-user
- You’ll be prompted for the Default Kerberos version 5 realm: which is likely your Open Directory servers domain name capitalised for example ‘PROFILEMANAGER.MACINTOSH-RESCUE.NET’
- Kerberos servers for your realm: will probably be the same in lowercase like ‘profilemanager.macintosh-rescue.net’
- Administrative server for your Kerberos realm: will likely be the same if you just have one server ‘profilemanager.macintosh-rescue.net’
- Now we can test the configuration by trying to acquire a Kerberos token with a known username: kinit -P merlin
- Enter the password when prompted then verify that the token has been acquired with: klist
Getting Usernames & Group Info from Open Directory
We now need to setup access to the user information stored in Open Directory’s LDAP database then configure the system to allow login of a network user:
- apt install libpam-krb5
- apt install libnss-ldap
- LDAP server URI: should be something like ldap://profilamanager.macintosh-rescue.net
- LDAP server search base: should be made up from the servers domain name levels so mine is: ‘dc=profilemanager,dc=macintosh-rescue,dc=net’
- LDAP version to use: is 3
- Clear all the following dialogues and enter with their fields blank
- Allow LDAP admin account to behave like local root? : probably not.
- Does the LDAP database require login? : no
- Now edit the /etc/nsswitch.conf file and add ‘ldap’ to the entries for ‘passwd:’, ‘group:’ and ‘shadow:’ like this:
- The system should now be able to see Network Users so you can try something like: id merlin #and see if you get some info.
- I’d recommend rebooting the system and trying a text login for a network user; you should get to a shell but without a home directory so that’s the next thing to fix.
Automatic Home Directory Creation:
For users to be able to practically login to the system and work they need a home directory, although this may not be necessary if they are only accessing services.
- apt install oddjob-mkhomedir
- vi /etc/pam.d/common-session
- Add the following line between ‘pam_ldap.so’ and ‘pam_systemd.so’: session optional pam_mkhomedir.so skel=/etc/skel umask=077
- Save the file, reboot and you should now be able to login as a Network User. Your home directory location is specified on the macOS Open Directory server so you will probably end up with a home directory stored in ‘/Users’ and not the ‘/home’ you’d expect on a linux system.
Conclusion
You should now be able to integrate a Debian based Linux system into an Apple centric directory service. Users can login, get a locally stored home folder in ‘/Users’, and they can administer their own passwords.
It will not be possible for the root user to change Open Directory passwords which would be true of a macOS client also.
Enjoy playing with your linux systems with integration into your network of Mac’s!
How to open a directory/folder and a URL through Terminal
I can navigate my files quite fast through terminal. Faster than double clicking. open. look, double click. etc. How do I open a directory in the Ubuntu GUI? For example:
cd projects client_project
Then voila, it opens in the Ubuntu GUI as if i navigated manually? Also, how can I open a URL in my default browser via terminal. It’d be awesome to go: F12
7 Answers 7
To Open Directory:
- To open a Folder from terminal type the following,
nautilus /path/to/that/folder
nautilus /home/karthick/Music xdg-open /home/karthick/Music
To Open URL:
- You can type any one of the following in terminal,
xdg-open http://google.com google-chrome http://google.com opera http://google.com firefox http://google.com
firefox www.google.com www.gmail.com
- Linux is case-sensitive, so type the file name correctly.
- You can also add an alias to short the command,for example if you need openurl instead of x-www-browser you should edit the .bashrc file
gedit ~/.bashrc - In the bottom of the file add the following lines
How to open and close directories in the Linux terminal
To open a directory on a computer with a graphical interface, you double-click on a folder. It opens, and you are now «in» that folder.
To open a directory in a terminal, you use the cd command to change your current directory. This essentially opens that folder and places you in it.
$ pwd /home/tux $ ls example.txt Documents Downloads Music Pictures Templates Videos $ cd Documents $ pwd /home/tux/Documents
Close a folder
To close a directory on a computer with a graphical interface, you close the window representing that directory.
You don’t have to close directories in a terminal, but you can always navigate away from a location you’ve made your current directory. The cd command, issued alone with no arguments, takes you back home.
Use the Linux terminal to see what files are on your computer
Learn how to use the ls command to list files in the terminal with this Linux tutorial.
20 Linux commands every sysadmin should know
If your application isn’t working—or you’re just looking for more information—these 20 commands will come in handy.
3 Linux terminals you need to try
Linux gives you the ability to choose the terminal interface you like—not one it imposes.
Seth Kenlon is a UNIX geek, free culture advocate, independent multimedia artist, and D&D nerd. He has worked in the film and computing industry, often at the same time.
1 Comment
It’s also helpful to know the shorthand for moving up in the directory structure.
cd ../
takes you up one level,
cd ../../
takes you up two levels, and so on.
Related Content
This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.
About This Site
The opinions expressed on this website are those of each author, not of the author’s employer or of Red Hat.
Opensource.com aspires to publish all content under a Creative Commons license but may not be able to do so in all cases. You are responsible for ensuring that you have the necessary permission to reuse any work on this site. Red Hat and the Red Hat logo are trademarks of Red Hat, Inc., registered in the United States and other countries.
A note on advertising: Opensource.com does not sell advertising on the site or in any of its newsletters.